Ad Group Media
Overview
The Ad Group Media API provides capabilities to create video profile by adding media to the Ad Group
Usage:
- Create Sponsored Video Profile by adding media to the Ad Group
- Fetch all sponsored video profiles with review status
Limitations
- Only one sponsored video profile is allowed for a campaign
- Media file must be uploaded and validated before being added to a video campaign
To understand details about ‘Request Header' or 'Authorization’,
please refer to the Authorization Guide
Description: The adgroup media endpoint is used to create a video profile
End Point: /api/v1/adGroup/media
HTTP Method: POST
Body Parameters
Parameter |
Description |
Type |
Required |
Possible Values |
advertiserId |
ID of the advertiser, uploading video asset |
Integer |
Y |
Unique numeric identifier |
campaignId |
ID of the campaign to which this ad group belongs |
Integer |
Y |
Unique numeric identifier |
adGroupId |
The ID of the ad group |
Integer |
Y |
Unique numeric identifier |
adGroupMediaId |
The value of adgroup media |
Integer |
Y |
Unique numeric identifier |
mediaId |
The unique Id of the media file |
Integer |
Y |
Unique numeric identifier |
Sample Request
| curl --location
'https://developer.api.us.stg.walmart.com/api-proxy/service/sp/api-sams/v1/api/v1/adGroup/media'
--header 'Authorization: Bearer ************************'
--header 'Content-Type: application/json'
--header 'wm_consumer.id: *************'
--header 'wm_sec.key_version: 2'
--header 'wm_sec.auth_signature: *************'
--header 'wm_qos.correlation_id: 12345'
--header 'wm_consumer.intimestamp: 1702298601000'
--data '{
"advertiserId": 1234,
"campaignId": 1234,
"adGroupId": 1234,
"mediaId": 1234
}'
|
| OkHttpClient client = new OkHttpClient().newBuilder().build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{
"advertiserId": 1234,
"campaignId": 1234,
"adGroupId": 1234,
"mediaId": 1234
}");
Request request = new Request.Builder()
.url("https://developer.api.us.stg.walmart.com/api-proxy/service/sp/api-sams/v1/api/v1/adGroup/media")
.method("POST", body)
.addHeader("Authorization", "Bearer *********************")
.addHeader("wm_consumer.id", "*************")
.addHeader("wm_sec.key_version", "2")
.addHeader("wm_sec.auth_signature", "*************")
.addHeader("wm_qos.correlation_id", "12345")
.addHeader("wm_consumer.intimestamp", "1702298601000")
.addHeader("Content-Type", "application/json").build();
Response response = client.newCall(request).execute();
|
| const axios = require('axios');
let data = JSON.stringify([
{
"advertiserId": 1234,
"campaignId": 1234,
"adGroupId": 1234,
"mediaId": 1234
}
]);
let config = {
method: 'post',
maxBodyLength: Infinity,
url: 'https://darpa.stage.sams.walmart.com/v1/adGroup/media',
headers: {
'Authorization': 'Bearer *********************************',
'wm_consumer.id': '************',
'wm_sec.key_version': '2',
'wm_sec.auth_signature': '************',
'wm_qos.correlation_id': '12345',
'wm_consumer.intimestamp': '1706708199000',
'Content-Type': 'application/json'
},
data : data
};
axios.request(config)
.then((response) => {
console.log(JSON.stringify(response.data));
})
.catch((error) => {
console.log(error);
});
|
| import requests
import json
url = "https://developer.api.us.stg.walmart.com/api-proxy/service/sp/api-sams/v1/api/v1/adGroup/media"
payload = json.dumps({
"advertiserId": 1234,
"campaignId": 1234,
"adGroupId": 1234,
"mediaId": 1234
})
headers = {
'Authorization': 'Bearer *********************************',
'wm_consumer.id': '************',
'wm_sec.key_version': '2',
'wm_sec.auth_signature': '************',
'wm_qos.correlation_id': '12345',
'wm_consumer.intimestamp': '1706708199000',
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
|
Response
Element |
Description |
Type |
code |
Possible values of the response code: success or failure |
String |
details |
Details of the error if response code is failure |
String |
adGroupMediaId |
Id that is generated in response to receiving a request for media asset |
Integer |
Sample Response
[
{
"code": "success",
"details": "",
"adGroupMediaId": 14324
}
]
HTTP Status Code
Status Code |
Description |
Possible Error Messages |
400 |
Bad Request |
- Maximum allowed size in batch is 50
- advertiserId validation failed
- campaignId validation failed
- adGroupId validation failed
- mediaId validation failed
|
403 |
Forbidden |
- You do not have write permission to this advertiser
- User not authenticated
|
404 |
Not Found |
- AdGroup not found
- Campaign not found
|
422 |
OperationNotAllowedException |
- Cannot define SBA Profile for non video campaigns
- Campaign is Under review, adding is not allowed
- AdGroup already has media defined, please update existing instead of defining new one
- AdGroup already has search amplifier defined, please update existing instead of defining new one
- Cannot be more than 2 sba profiles in an adGroup
|
Description: Retrieve list of ad group media profile for a specific campaign
End Point: /api/v1/adGroup/media
HTTP Method: GET
Query Parameters
Parameter |
Description |
Type |
Required |
Possible Values |
campaignId |
The ID of the campaign for which media details should be returned |
Integer |
Y |
Unique numeric identifier |
adGroupId |
The ID of the adgroup for which media details should be returned |
Integer |
Y |
Unique numeric identifier |
Sample Request
| curl --location --request GET
'https://developer.api.us.stg.walmart.com/api-proxy/service/sp/api-sams/v1/api/v1/adGroup/media?campaignId={campaignId}&adGroupId={adGroupId}'
--header 'Authorization: Bearer *********************'
--header 'accept: application/json'
--header 'WM_SEC.AUTH_SIGNATURE: ***********'
--header 'WM_CONSUMER.ID: ************'
--header 'WM_CONSUMER.intimestamp: 1565309779'
--header 'Content-Type: application/json'
|
| OkHttpClient client = new OkHttpClient().newBuilder().build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType,"");
Request request = new Request.Builder()
.url("https://developer.api.us.stg.walmart.com/api-proxy/service/sp/api-sams/v1/api/v1/adGroup/media?campaignId={campaignId}&adGroupId={adGroupId}")
.method("GET", body)
.addHeader("Authorization", "Bearer *********************")
.addHeader("accept", "application/json")
.addHeader("WM_SEC.AUTH_SIGNATURE", "***********")
.addHeader("WM_CONSUMER.ID", "************")
.addHeader("WM_CONSUMER.intimestamp", "1565309779")
.addHeader("Content-Type", "application/json").build();
Response response = client.newCall(request).execute();
|
| const axios = require('axios');
let config = {
method: 'get',
maxBodyLength: Infinity,
url: 'https://darpa.stage.sams.walmart.com/api/v1/adGroup/media?campaignId={campaignId}&adGroupId={adGroupId}',
headers: {
'Authorization': 'Bearer ******************',
'wm_consumer.id': '************',
'wm_sec.key_version': '2',
'wm_sec.auth_signature': '************',
'wm_qos.correlation_id': '12345',
'wm_consumer.intimestamp': '1706708199000',
'Content-Type': 'application/json',
}
};
axios.request(config)
.then((response) => {
console.log(JSON.stringify(response.data));
})
.catch((error) => {
console.log(error);
});
|
| import requests
import json
url = "https://developer.api.us.stg.walmart.com/api-proxy/service/sp/api-sams/v1/api/v1/adGroup/media?campaignId={campaignId}&adGroupId={adGroupId}"
payload = {}
headers = {
'Authorization': 'Bearer ******************',
'wm_consumer.id': '************',
'wm_sec.key_version': '2',
'wm_sec.auth_signature': '************',
'wm_qos.correlation_id': '12345',
'wm_consumer.intimestamp': '1706708199000',
'Content-Type': 'application/json',
}
response = requests.request("GET", url, headers=headers, data=payload)
print(response.text)
|
Response
Element |
Description |
Type |
campaignId |
ID of the campaign associated with the respective ad group |
Integer |
adGroupId |
ID of the ad group |
Integer |
adGroupMediaId |
The value of adgroup media |
Integer |
mediaId |
The unique Id of the media file |
Integer |
reviewStatus |
Status of review. Possible values: pending, approved, rejected |
String |
reviewReason |
detail reason for failure scenario |
String |
status |
Status of campaign. Possible values: enabled, disabled |
String |
Sample Response
[
{
"campaignId": 56669,
"adGroupId": 770866222,
"adGroupMediaId": 14324,
"mediaId": 10496,
"reviewStatus": "approved",
"reviewReason": null,
"status": "enabled"
}
]
HTTP Status Code
Status Code |
Description |
Possible Error Messages |
404 |
Not Found |
- SBA Profile details not found for AdGroup
- AdGroup Media not found for AdGroup
- This endpoint is not allowed for this campaign type
|
422 |
OperationNotAllowedException |
- Please use sbaProfile endpoints for sbaProfile
- Please use AdGroupMedia endpoints for AdGroupMedia
|
500 |
Internal Server Error |
There was an error processing the request |