Update Existing Campaigns
URL: PUT /api/v1/campaigns
Note:
- This API supports batch operations with a max batch size of 10. For bulk operation, the advertiserId must be the same across all requests in the payload.
- PUT API requests will overwrite all current values and are not intended to be used as incremental updates like PATCH operations
- You must set all of
budgetType,dailyBudget,totalBudget,startDate,endDate, anddeliverySpeedparameters at same level, i.e. either at campaign level or ad group level. Attempting to alter the "level" at which they are set via a PUT request will result in a validation error. mediaTypefield cannot be modified after creating a campaign.mediaTypeis ignored when included in the request payload.- For details on updatable fields, refer to this link
Request Parameters
| Parameters | Notes | Type | Required | Possible Values |
|---|---|---|---|---|
| campaignId | ID of the campaign | integer | Y | Valid campaign ID |
| advertiserId | ID of advertiser | integer | Y | Valid advertiser ID |
| name | The name of the campaign Note: Limit on length of campaign name is 240 characters | string | Y | The campaign name should be unique |
| description | Campaign description Note: Limit on length of campaign description is 240 characters | string | N | Provide valid description corresponding to campaign type |
| objective | Specifies the campaign objective. Note: You can update objective only if the campaign has never gone live | string | N | Values: If the objective is not specified in the request payload, the existing value of the objective will be retained. |
| campaignType | The type of the campaign Note:
| string | N | Values of campaignType: ngd |
| startDate | The date to start campaign Note:
| date | Conditional. This field is required only if it is not set at ad group level. Cannot be changed to ad group level later | Date should be in format: yyyy-MM-dd'T'HH:mm:ss.SSSXXX Note:
Kindly take these behaviors into consideration when assigning a value to startDate in your request. |
| endDate | The date when campaign ends Note: it must be set either at campaign or ad group level | date | Conditional. This field is required only if it is not set at ad group level. Cannot be changed to ad group level later | Date should be in format: yyyy-MM-dd'T'HH:mm:ss.SSSXXX To run campaign indefinitely, set its value as ‘9999-12-30T00:00:00Z’ Note:
Kindly take these behaviors into consideration when assigning a value to startDate in your request. |
| budgetType | The type of budget allocation you want to choose for your campaign Note:
| string | Conditional. This field is required only if it is not set at ad group level. Cannot be changed to ad group level later | Values:
|
| dailyBudget | Daily budget of campaign Note:
| double | Conditional. This field is required only if:
| The value of daily budget should at least be $0.01 Note: This field is required only if budgetType is set to be dailyBudget |
| totalBudget | Total budget of campaign Note: it must be set either at campaign or ad group level | double | Conditional. This field is required only if: budgetType is set to be total | The value of total budget should at least be $0.01 Note: This field is required only if budgetType is set to be totalBudget |
| deliverySpeed | Determines pacing of ad delivery Note:
| string | Conditional. This field is required only if it is not set at ad group level. Cannot be changed to ad group level later | Values:
|
- You must set all of budgetType, dailyBudget, totalBudget, startDate, endDate, and deliverySpeed parameters at same level i.e. either at campaign level or ad group level, not both
- You cannot change the level at which budgetType, dailyBudget, totalBudget, startDate, endDate, and deliverySpeed are set i.e. if these are set at campaign level while creating the campaign, it cannot be changed to ad group later and vice versa.
- You can only set either dailyBudget or totalBudget
- To set daily budget, you must choose value of budgetType as “daily” and then define dailyBudget.
- To set total budget, you must choose value of budgetType as “total” and then define totalBudget.
- mediaType field cannot be modified after a campaign is created. mediaType, if included in the request payload, is ignored and will not be modified.
- Campaigns created to run definitely can be updated later to include an end date
Headers
| Header Name | Description | Required | Values |
|---|---|---|---|
| Authorization | The token will provide you the access to the API. It is same for all advertisers you access through the API. | Y | Please utilize the generated auth_token shared with you at the time of partner onboarding from the Getting Started Guide |
| Content-Type | Format of the message body | Y | application/json |
| WM_CONSUMER.ID | Unique ID for consumer. We will provide you the consumer ID to access the API. It is same for all advertisers you access through the API. | Y | Please use the generated ConsumerId shared with you at the time of partner onboarding. Refer to the Getting Started Guide for more information |
| WM_SEC.AUTH_SIGNATURE | Auth signature as an API key. | Y | Use the signature generator code from Getting Started Guide to generate this value |
| WM_SEC.KEY_VERSION | Key version. We will provide you with the KEY VERSION to access the API. It is same for all advertisers you access through the API. | Y | 1 |
| WM_CONSUMER.intimestamp | Timestamp for which the auth signature is generated. Use Unix epoch format for the timestamp. | Y | Use the signature generator code from Getting Started Guide to generate this value |
Sample Request
curl -X PUT \ 'https://developer.api.us.stg.walmart.com/api-proxy/service/display/api/v1/api/v1/campaigns' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer <auth_token>' \ --header 'WM_SEC.AUTH_SIGNATURE: **************' \ --header 'WM_SEC.KEY_VERSION: 1' \ --header 'WM_CONSUMER.ID: adfwe-v23-faasd2r-afs-asdfqeff' \ --header 'WM_CONSUMER.INTIMESTAMP: 1565309779' \ --data '[ { "campaignId": 1, "advertiserId": 1, "name": "string", "description": "string", "objective": "awareness", "campaignType": "ngd", "startDate": "2023-12-05T12:00:00Z", "endDate": "2023-12-25T12:00:00Z", "budgetType": "daily", "dailyBudget": 1.0, "deliverySpeed": "evenly" } ]'
Sample Request (Batch Operation)
curl -X PUT \ 'https://developer.api.us.stg.walmart.com/api-proxy/service/display/api/v1/api/v1/campaigns' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer <auth_token>' \ --header 'WM_SEC.AUTH_SIGNATURE: **************' \ --header 'WM_SEC.KEY_VERSION: 1' \ --header 'WM_CONSUMER.ID: adfwe-v23-faasd2r-afs-asdfqeff' \ --header 'WM_CONSUMER.INTIMESTAMP: 1565309779' \ --data '[ { "campaignId": 12345, "advertiserId": 10000, "name": "string", "description": "string", "objective": "awareness", "campaignType": "ngd", "startDate": "2023-12-05T12:00:00Z", "endDate": "2023-12-25T12:00:00Z", "budgetType": "total", "totalBudget": 10.0, "deliverySpeed": "evenly" }, { "campaignId": 23456, "advertiserId": 10000, "name": "string", "description": "string", "objective": "awareness", "campaignType": "ngd", "startDate": "2023-12-05T12:00:00Z", "endDate": "2023-12-25T12:00:00Z", "budgetType": "total", "totalBudget": 10.0, "deliverySpeed": "frontloaded" } ]'
Response
| Element | Description | Type |
|---|---|---|
| code | The response code can have following values:
Click here for more information about Status Codes and Errors | string |
| details | Details will populate success or error message depending upon value of code | string |
| campaignId | ID of the campaign | integer |
Sample Response
[ { "code": "success", "details": ["string"], "campaignId": 1 } ]
Sample Response (Batch Operation)
[
{ "code": "success", "details": ["string"], "campaignId": 1
}, { "code": "failure", "details": ["stringA", "stringB"], "campaignId": 2 }
]
