Skip to content

Media

Overview

The Media API provides capabilities to upload, modify and fetch video assets.

Usage:

  • To create an allocation to upload a video asset and an optional closed caption file
  • To upload the video asset and closed Caption File to the uploadUrl
  • To accept the video upload notification
  • To fetch the video validation outcome by passing the mediaId of the video asset
  • To update the media file name

Limitations

  • Currently, we do not have the capability to delete the media file for an advertiser
  • We do not support previewing the video file

To understand details about ‘Request Header' or 'Authorization’, please refer to the Authorization Guide

Upload Media

Description: The upload media endpoint is used to create a location to upload a video asset and an optional closed caption file (recommended if the video has spoken words). This location is short-lived and expires in 15 minutes.

End Point: /api/v1/media/upload

HTTP Method: POST

Query Parameters

Parameter Description Type Required Possible Values
advertiserId ID of the advertiser, uploading video asset Integer Y Unique numeric identifier
mediaType The value of mediaType is “video”. String Y Relevant string value representing the media type

Note: mediaType paramerter should be follow:

  • The file size must be less than 500 MB.
  • The file format must be .MP4 or .MOV
  • The aspect ratio should be 16:9.
  • The dimensions must be 1920 x 1080px – 3840 x 2160px​.
  • The duration must be 5–30 seconds.
  • Video codec must be H.264 or H.265.
  • The audio codec must be AAC, MP3, PC.
  • Caption file format should be .srt or .vtt.
  • Currently, there is no restriction on the number of videos that an advertiser can upload for an advertiser account

Sample Request

curl --location  
 'https://developer.api.us.stg.walmart.com/api-proxy/service/sp/api-sams/v1/api/v1/media/upload?advertiserId={advertiserId}' 
--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 '{
    "mediaType": "video",
    "advertiserId": 1234
}'
OkHttpClient client = new OkHttpClient().newBuilder().build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{
    "mediaType": "video",
    "advertiserId": 1234
}");
Request request = new Request.Builder()
  .url("https://developer.api.us.stg.walmart.com/api-proxy/service/sp/api-sams/v1/api/v1/media/upload?advertiserId={advertiserId}")
  .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({ 
"mediaType": "video", 
"advertiserId": 1234 
}); 
let config = { 
method: 'post', 
maxBodyLength: Infinity, 

url: 'https://developer.api.us.stg.walmart.com/api-proxy/service/sp/api-sams/v1/api/v1/media/upload?advertiserId={advertiserId}', 

headers: {  
    'wm_consumer.id': '****************',  
    'wm_sec.key_version': '2',  
    'wm_sec.auth_signature': '*************',  
    'wm_qos.correlation_id': '12345',  
    'wm_consumer.intimestamp': '*************',  
    'Content-Type': 'application/json',  
    'Authorization': 'Bearer ****************' 
    }, 
    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/media/upload??advertiserId={advertiserId}" 
payload = json.dumps({ 
    "mediaType": "video", 
    "advertiserId": 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
mediaUploadRequestId Id that is generated in response to receiving a request for uploading a video asset Integer
uploadUrl The URL to upload the media.
Note: The URL expires in 15 minutes. The upload location only supports PUT HTTP method to upload the media content.
String
captionUrl The URL to upload the closed caption file.
Note: The URL expires in 15 minutes. The upload location only supports PUT HTTP method to upload the caption file.
String

Sample Response

[
   {
        "code": "success",    
        "details": "",    
        "mediaUploadRequestId": 600001,    
        "uploadUrl": 
        "https://b4e0184a3estg.blob.core.windows.net/video.mp4?sv=2021-08-06&se=2022-08-19T05%3A05%3A23Z&sr=b&sp=rcwl&sig=DvVyinZhZo1gNahI%2BRobR4oxXMyXmQG8gD04ZraInoY%3D",    
        "captionUrl": "https://b4e0184a3estg.blob.core.windows.net/caption.srt?sv=2021-08-06&se=2022-08-19T05%3A05%3A23Z&sr=b&sp=rcwl&sig=1aVWrnICQAQGV7lZ3JDuL1W8gOkPOqLYLim6JtRN6X0%3D" 
   }
]

HTTP Status Code

Status Code Description Possible Error Messages
400 Bad Request
  • Advertiser Id validation failed
  • Invalid media Type
  • Advertiser <advertiserId> is not allowed to use this feature
  • Advertiser Id: <advertiserId> is not eligible for this type of campaign. Please ensure that your brand is registered as an approved brand with brandportal.walmart.com before submitting this campaign create request.
  • You have exceeded the maximum number of 10 media upload requests per account. Please try again later.
  • You have reached the limit of 200 videos, please delete unwanted ones among videos that you own
403 Forbidden
  • User not authenticated
  • AdOps role does not access to any campaigns
  • You do not have write permission to this advertiser
  • Video ads feature is not enabled
429 Too Many Requests <Exception Message>
500 Internal Server Error There was an error processing the request

Upload the Media File to Upload Location

Description

Use this endpoint to

  • Upload the video asset to the uploadUrl
  • Upload the closed caption file to captionUrl. Upload of caption file is optional
  • Request body to include binary data of mp4 or .mov video file

    Note: You receive the uploadUrl and captionUrl in response of POST operation

Sample Request

curl --location --request PUT 
'https://developer.api.us.stg.walmart.com/api-proxy/service/sp/api-sams/v1/api/v1/media/complete' 
--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' 
--data '{
    "advertiserId": 1234,
    "mediaName": "Sample Video",
    "mediaUploadRequestId": 1234
}'
OkHttpClient client = new OkHttpClient().newBuilder().build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, 
"{
    "advertiserId": 1234,
    "mediaName": "Sample Video",
    "mediaUploadRequestId": 1234
}");
Request request = new Request.Builder()
  .url("https://developer.api.us.stg.walmart.com/api-proxy/service/sp/api-sams/v1/api/v1/media/complete")
  .method("PUT", 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 data = JSON.stringify({ 
"advertiserId": 1234, 
"mediaUploadRequestId": 1234 
"mediaName": "Sample Video" 
    }); 
let config = { 
method: 'put', 
maxBodyLength: Infinity, 

url: 'https://developer.api.us.stg.walmart.com/api-proxy/service/sp/api-sams/v1/api/v1/media/complete', 

headers: {  

    'wm_consumer.id': '****************',  
    'wm_sec.key_version': '2',  
    'wm_sec.auth_signature': '*************',  
    'wm_qos.correlation_id': '12345',  
    'wm_consumer.intimestamp': '*************',  
    'Content-Type': 'application/json',  
    'Authorization': 'Bearer ****************' 
}, 
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/media/complete" 
payload = json.dumps({ 
    "advertiserId": 1234, 
    "mediaUploadRequestId": 1234, 
    "mediaName": "Sample Video" 
}) 
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("PUT", url, headers=headers, data=payload) 
print(response.text) 

Sample Response 1

  • If the video upload is successful - response 201
  • If video upload failure – generic error message

Sample Response 2

  • If closed caption file upload successful – response 201
  • If closed caption file upload failure - generic error message


Complete Media Upload

Description

  • Use this endpoint to accept video upload notification
  • This endpoint is called once the media is uploaded to the location provided by the /api/v1/media/upload API endpoint
  • This API creates a media resource for the video asset. The media resource is represented by a media identifier. The media identifier can be used to associate the media with the adGroup for Sponsored Videos.
  • Once the media is uploaded, the API internally kicks off a background process for validating the technical specifications of the media file. As a result, the media may not be immediately available for use in a Sponsored Video campaign. See /api/v1/media endpoint to get details on when the media is available to be used in a campaign.  

End Point: /api/v1/media/complete

HTTP Method: PUT

Query Parameters

Parameter Description Type Required Possible Values
advertiserId The ID of the ad group. Required only if updating an existing ad group. Integer Y Unique numeric identifier
mediaName The title of the video is creative. The maximum file name size is 45 characters and no special characters are allowed. String Y Relevant string value representing the name of the video asset
mediaUploadRequestId ID that is generated in response to receiving a request for uploading a video asset. Integer Y Unique numeric identifier

Sample Request

curl --location --request PUT 
'https://developer.api.us.stg.walmart.com/api-proxy/service/sp/api-sams/v1/api/v1/media/complete' 
--header 'Authorization: Bearer *********************' 
--header 'wm_consumer.id: *************' 
--header 'wm_sec.key_version: 2' 
--header 'wm_sec.auth_signature: *************' 
--header 'wm_qos.correlation_id: 1235' 
--header 'wm_consumer.intimestamp: 1702298601000' 
--header 'Content-Type: application/json' 
--data '{
    "advertiserId": 1234,
    "mediaName": "Sample Video",
    "mediaUploadRequestId": 1234
}'
OkHttpClient client = new OkHttpClient().newBuilder().build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, 
"{
    "advertiserId": 1234,
    "mediaName": "Sample Video",
    "mediaUploadRequestId": 1234
}");
Request request = new Request.Builder()
  .url("https://developer.api.us.stg.walmart.com/api-proxy/service/sp/api-sams/v1/api/v1/media/complete")
  .method("PUT", 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,
"mediaUploadRequestId": 1234, 
"mediaName": "Sample Video" 
}); 
let config = { 
method: 'put', 
maxBodyLength: Infinity, 

url: 'https://developer.api.us.stg.walmart.com/api-proxy/service/sp/api-sams/v1/api/v1/media/complete', 

headers: {  
    'wm_consumer.id': '****************',  
    'wm_sec.key_version': '2',  
    'wm_sec.auth_signature': '*************',  
    'wm_qos.correlation_id': '12345',  
    'wm_consumer.intimestamp': '*************',  
    'Content-Type': 'application/json',  
    'Authorization': 'Bearer ****************' 
}, 
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/media/complete" 
payload = json.dumps({ 
    "advertiserId": 1234, 
    "mediaUploadRequestId": 1234, 
    "mediaName": "Sample Video" 
}) 
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("PUT", url, headers=headers, data=payload) 
print(response.text) 

Response

Element Description Type
code Status of the ad group update operation Values: Success or Failure String
details Details of the failure in case of video file/caption file validation error String
mediaId Details of the failure in case of video file/caption file validation error Integer
errors Error description in case of failure. It consists of the following with string datatype: message, type, code Array

Sample Response

[
  {
    "code": "success",
    "details": "",
    "mediaId": 600001,
    "errors": [
      {
        "message": "message1",
        "type": "VALIDATION",
        "code": "E_ASPECT_RATIO"
      },
      {
        "message": "message2",
        "type": "VALIDATION",
        "code": "E_MIN_PIXEL"
      }
    ]
  }
]

HTTP Status Code

Status Code Description Possible Error Messages
200 OK
  • Invalid MediaUploadRequest status
  • Failed to complete the media
400 Bad Request
  • Advertiser Id validation failed
  • mediaUploadRequestId validation failed
  • mediaName validation failed
403 Forbidden
  • User not authenticated
  • AdOps role does not access to any campaigns
  • You do not have write permission to this advertiser
  • Video ads feature is not enabled
  • You don't have access to this advertiser
404 Not Found MediaUploadRequest not found
429 Too Many Requests <Exception Message>
500 Internal Server Error There was an error processing the request

Update the Media Details

Description: Use this endpoint to Update the media file name

End Point: /api/v1/media

HTTP Method: PUT

Query Parameters

Parameter Description Type Required Possible Values
advertiserId The ID of the advertiser Integer Y Unique numeric identifier
mediaName The title of the video asset
Note: The mediaName can have a maximum size of 45 characters, with no special characters allowed
String Y Relevant string value representing the name of the video asset
mediaId The unique Id of the media file Integer Y Unique numeric identifier

Sample Request

curl --location --request PUT  
'https://developer.api.us.stg.walmart.com/api-proxy/service/sp/api-sams/v1/api/v1/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,
    "mediaName": "Updated Sample Video",
    "mediaId": 1234
}'
OkHttpClient client = new OkHttpClient().newBuilder().build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, 
"{
    "advertiserId": 1234,
    "mediaName": "Updated Sample Video",
    "mediaId": 1234
}");
Request request = new Request.Builder()
  .url("https://developer.api.us.stg.walmart.com/api-proxy/service/sp/api-sams/v1/api/v1/media")
  .method("PUT", 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, 
"mediaName": "Updated Sample Video", 
"mediaId": 1234 
}); 
let config = { 
method: 'put', 
maxBodyLength: Infinity, 

url: 'https://developer.api.us.stg.walmart.com/api-proxy/service/sp/api-sams/v1/api/v1/media', 

headers: {  
    'wm_consumer.id': '****************',  
    'wm_sec.key_version': '2',  
    'wm_sec.auth_signature': '*************',  
    'wm_qos.correlation_id': '12345',  
    'wm_consumer.intimestamp': '*************',  
    'Content-Type': 'application/json',  
    'Authorization': 'Bearer ****************' 
}, 
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/media" 
payload = json.dumps({ 
    "advertiserId": 1234, 
    "mediaName": "Updated Sample Video", 
    "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("PUT", url, headers=headers, data=payload) 
print(response.text) 

Response

Element Description Type
code Status of the ad group update operation Values: success or Failure String
details Details of the update String
mediaId The unique Id of the media file whose title is changed successfully Integer

Sample Response

[
  {
     "code": "success",
     "details": "",
     "mediaId": 700001
  }
]

HTTP Status Code

Status Code Description Possible Error Messages
400 Bad Request
  • Advertiser Id validation failed
  • mediaId validation failed
  • mediaName validation failed
403 Forbidden
  • User not Authenticated
  • Video ads feature is not enabled
  • AdOps role does not access to any campaigns
  • You do not have write permission to this advertiser
  • You don't have access to this advertiser
404 Not Found MediaDetails not found
429 Too Many Requests <Exception Message>
500 Internal Server Error There was an error processing the request

List All the Media

Description:

  • This endpoint is used to fetch the video validation outcome by passing the mediaId of the video asset. It polls Sam's Club system to check the video validation status and returns the result.
  • For a video asset to be associated with a campaign, the corresponding media file should be in AVAILABLE status. The AVAILABLE status guarantees that the background process has completed the processing of the video asset and that it is available for usage in a Sponsored Video campaign. The validated video asset represents the video profile.
  • The background processing can take approximately take ~30 minutes to complete. We recommend polling the system to check for the video validation 30 minutes after uploading, with a backoff timer of 15 minutes.
  • The endpoint can also be used to list all the video files along with their status for a given advertiser. Optionally, you can also filter by the status of the media file (PENDING, FAILED or AVAILABLE) to list only files matching the status for a given.

End Point: /api/v1/media

HTTP Method: GET

Query Parameters

Parameter Description Type Required Possible Values
advertiserId The ID of the advertiser Integer Y Unique numeric identifier
mediaId The unique Id of the media file generated from the notify media upload complete call
Note: When an advertiser id and multiple media ids are provided, the service shall return the media details qualifying for the first media id.
Integer N Unique numeric identifier
status The value represents the status of the media file.
Note: When an advertiser id and multiple status are provided, the service shall return the media details qualifying for the first status.
String N Relevant string value representing the status (PENDING, FAILED, AVAILABLE)

Sample Request

1
2
3
4
5
6
7
8
9
curl --location 
'https://developer.api.us.stg.walmart.com/api-proxy/service/sp/api-sams/v1/api/v1/media?advertiserId={advertiserId}' 
--header 'Authorization: Bearer *********************'
--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: 1703583174000'
--data '' 
OkHttpClient client = new OkHttpClient().newBuilder().build(); 
MediaType mediaType = MediaType.parse("text/plain"); 
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/media?advertiserId={advertiserId}") 
 .method("GET", 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", "1703583174000").build(); 
Response response = client.newCall(request).execute(); 
const axios = require('axios'); 
let data = ''; 
let config = { 
method: 'get', 
maxBodyLength: Infinity, 

url: 'https://developer.api.us.stg.walmart.com/api-proxy/service/sp/api-sams/v1/api/v1/media?advertiserId={advertiserId}', 

headers: {  
    'wm_consumer.id': '****************',  
    'wm_sec.key_version': '2',  
    'wm_sec.auth_signature': '*************',  
    'wm_qos.correlation_id': '12345',  
    'wm_consumer.intimestamp': '*************',  
    'Authorization': 'Bearer ****************' 
}, 
data : data 
}; 
axios.request(config) 
.then((response) => { 
console.log(JSON.stringify(response.data)); 
}) 
.catch((error) => { 
console.log(error); 
}); 
import requests 
url = "https://developer.api.us.stg.walmart.com/api-proxy/service/sp/api-sams/v1/api/v1/media?advertiserId={advertiserId}" 
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'
} 
response = requests.request("GET", url, headers=headers, data=payload) 
print(response.text) 

Response

Element Description Type
mediaId The unique Id of the media file generated from the notify media upload complete call Integer
status Expected values: PENDING, AVAILABLE, FAILED String
details Details of the media String
name Name of the media String
thumbnail URL for the image snapshot of video String

Sample Response

[
   {
      "mediaId": 500003,
      "status": "AVAILABLE",
      "details": "details abc",
      "name": "abc 4",
      "thumbnail": "https://advertising.com"
   }
]

HTTP Status Code

Status Code Description Possible Error Messages
400 Bad Request advertiserId not found in request
403 Forbidden
  • User not authenticated
  • AdOps role does not access to any campaigns
  • You do not have write permission to this advertiser
  • Video ads feature is not enabled
404 Not Found MediaDetails not found
429 Too Many Requests <Exception Message>
500 Internal Server Error There was an error processing the request