JSON Serialised Parameters
Some API calls require you to pass in a body parameter whose value is a JSON Serialised string of an object. However, because we are using OAuth as our authentication process, it will be content-type
of application/x-www-form-urlencoded
.
Here we are going to use an example to demonstrate how to populate those parameters. We will be using the add asset to a collection call for that.
For this purpose, all the required parameters are given:
- Collection's id:
C11F654D-2245-4D08-80F5049F98E55F66
Ids of assets to be added:
D4AC0B41-141B-47D2-98B4FECDA8894CB2
10F8D69E-51B8-4C7D-95B74111C07BBA1F
Based on that information, we have to create a JSON representation of the given list of asset ids in order to populate the data
parameter of the API request. Here is the corresponding example call:
HTTP Parameter | Value |
---|---|
Http Method | POST |
URL | https://byndair.getbynder.com/api/v4/collections/C11F654D-2245-4D08-80F5049F98E55F66/media/ |
Body load type | application/x-www-form-urlencoded data:["D4AC0B41-141B-47D2-98B4FECDA8894CB2","10F8D69E-51B8-4C7D-95B74111C07BBA1F"] |
As you can see, the body is using application/x-www-form-urlencoded
, in order to send the request body parameters. Additionally, the value of the required body parameter data
contains the JSON representation of a list of unique identifiers, that is: ["D4AC0B41-141B-47D2-98B4FECDA8894CB2","10F8D69E-51B8-4C7D-95B74111C07BBA1F"]
.