Create Widget
Create Widget
POST
https://api.ocamba.com/v2/ocamba/widgets
Creates a new Widget objectRequest schema
bodyResponse schemas
›
201
application/json
curl -X POST \
"https://api.ocamba.com/v2/ocamba/widgets" \
-H "Authorization: Bearer {TOKEN}" \
-H "Content-Type: application/json" \
-d '{
"app_id": "1001",
"ref": "w1",
"name": "Top 10",
"description": "Displays top 10 users with most activities",
"type": "timeline",
"conf": {
"metric": {
"sparkline": true
}
},
"ds": {
"fields": "cir,click,conversion,cpc",
"filter": null,
"resolution": null,
"source": "adex.advertiser",
"timeshift": null
}
}'const url = 'https://api.ocamba.com/v2/ocamba/widgets';
const options = {
method: 'POST',
headers: {
Authorization: "Bearer {TOKEN}",
'Content-Type': "application/json"
},
body: JSON.stringify(
{
"app_id": "1001",
"ref": "w1",
"name": "Top 10",
"description": "Displays top 10 users with most activities",
"type": "timeline",
"conf": {
"metric": {
"sparkline": true
}
},
"ds": {
"fields": "cir,click,conversion,cpc",
"filter": null,
"resolution": null,
"source": "adex.advertiser",
"timeshift": null
}
}
)
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}$ch = curl_init("https://api.ocamba.com/v2/ocamba/widgets");
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"Authorization: Bearer {TOKEN}",
"Content-Type: application/json"
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(
[
"app_id" => "1001",
"ref" => "w1",
"name" => "Top 10",
"description" => "Displays top 10 users with most activities",
"type" => "timeline",
"conf" => [
"metric" => [
"sparkline" => true
]
],
"ds" => [
"fields" => "cir,click,conversion,cpc",
"filter" => null,
"resolution" => null,
"source" => "adex.advertiser",
"timeshift" => null
]
]
));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);Responses
201 Created
Responses