Update Campaign - PATCH

Use this endpoint to apply bulk, partial updates to existing campaigns. The API adheres to standard PATCH semantics, meaning only the fields included in the request body are updated, while all unspecified campaign attributes remain unchanged

📘

URL: PATCH /api/v1/campaigns

Note:

  • Supports up to 10 campaign objects per request. For bulk operation, the advertiserId must be uniform across all campaign objects within a single payload
  • Partial updates are applied at the field level. To clear an existing field value, explicitly pass null
  • All of budgetType, dailyBudget, totalBudget, startDate, endDate, and deliverySpeed must be set 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 PATCH request will result in a validation error
  • For details on updatable fields, refer to this link

Request Parameters

ParametersNotesTypeRequiredPossible Values
advertiserIdID of advertiserintegerYValid advertiser ID
campaignIdID of the campaign to be updatedintegerYValid campaign ID
nameThe name of the campaign
Note: Limit on length of campaign name is 240 characters
stringYThe campaign name should be unique
descriptionDescription of the campaign
Note: Limit on length of campaign description is 240 characters
stringNProvide valid description corresponding to campaign type
objectiveSpecifies the campaign objective.
Note: You can update objective only for draft campaigns
stringN

Values:
• awareness
• engagement
• conversion
• default
Note: Use "default" only for updating older campaigns created before the objective feature was introduced.
These campaigns will display "default" as their objective in the campaign list API.
Using "default" for other campaigns will overwrite their objectives with "default"

If the objective is not specified in the request payload, the existing value of the objective will be retained.

campaignTypeThe type of the campaign
Note:
  • Currently, only onsite display auction campaigns are supported
  • You can not update campaignType, after campaign is created
stringNValues of campaignType: ngd
startDateThe date to start campaignstringConditional.
This field is required only if it is not set at ad group level. Cannot be changed to ad group level later
ISO 8601 Format: yyyy-MM-dd'T'HH:mm:ss.SSSXXX
endDateThe date when campaign endsstringConditional.
This field is required only if it is not set at ad group level. Cannot be changed to ad group level later

ISO 8601 Format: yyyy-MM-dd'T'HH:mm:ss.SSSXXX


To run campaign indefinitely, set its value as ‘9999-12-30T00:00:00Z’


Must be a time after 12pm ET

budgetTypeBudget allocation typestringN

Values:


- daily

- total

dailyBudget

Daily budget of campaign
Note:


- Daily budget cannot exceed your total budget amount

- Up to 20% of the unspent budget will be rolled over to the next day

- Campaigns scheduled to run indefinitely must use a daily budget

- Attempting to update dailyBudget for a campaign with totalBudget will result in error

doubleConditional. This field is required only if:
  • It is not set at ad
    group level.
  • budgetType is set to be daily
The value of daily budget should at least be $0.01
totalBudgetTotal budget of campaign

Attempting to update totalBudget for a campaign with dailyBudget will result in error
doubleConditional. This field is required only if:
  • It is not set at ad
    group level.
  • budgetType is set to be total
The value of total budget should at least be $0.01
deliverySpeedDetermines pacing of ad delivery
Note:
You can update it only for campaigns in DRAFT state
stringNValues:
  • frontloaded
  • evenly

👉

Rules

  • 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.
  • Budget, Schedule and Delivery speed must be set either at campaign or ad group level
  • mediaType field cannot be modified after a campaign is created. mediaType, if included in the request payload, is ignored and will not be modified.

Headers

Header NameDescriptionRequiredValues
AuthorizationThe token will provide you the access to the API. It is same for all advertisers you access through the API.YPlease utilize the generated auth_token shared with you at the time of partner onboarding from the Getting Started Guide
Content-TypeFormat of the message bodyYapplication/json
WM_CONSUMER.IDUnique 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.   YPlease 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_SIGNATURESignature for authenticationYUse the signature generator code from Getting Started Guide to generate this value
WM_SEC.KEY_VERSIONKey version. We will provide you with the KEY VERSION to access the API. It is same for all advertisers you access through the API.Y1
WM_CONSUMER.intimestampTimestamp for which the auth signature is generated. Use Unix epoch format for the timestamp.YUse the signature generator code from Getting Started Guide to generate this value

Sample Request - Remove Description and Update Campaign Name

curl -X PATCH \ '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, "description": null, "name": "test-name3" } ]'

Sample Request - Update Campaign Name

curl -X PATCH \ '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": "test-name" } ]'

Sample Request - Update Multiple Campaigns

curl -X PATCH \ '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": "test-name1", "description": "test-description" }, { "campaignId": 2, "advertiserId": 1, "name": "test-name2", "description": "test-description", "objective": "awareness" } ]'

Response

FieldDescriptionOptional field/Nullable?TypePossible values
codeThe response code can have following values:
  • success
  • failure

Click here for more information about Status Codes and Errors
Nstringsuccess, failure
detailsDetails will populate success or error message depending upon value of code.NstringRefer to this link for detailed error messages
campaignIdID of the updated campaign.Yinteger
messageHigh-level summary of the error, when available. Ystring 
errorsDetailed information about one or more errors, including the affected field (when applicable), error code, and a human-readable description.Yarray<object> 

errors Array Object Details

FieldDescriptionOptional field/Nullable?TypePossible values
fieldJSON field associated with the error (for example, startDate). Omitted if the error applies to the request as a whole.Ystring 
errorTypeMachine-readable error code that uniquely identifies the error condition. Applications should use this value for error handling logic.Nstring 
descriptionHuman-readable explanation of the error, including why the request failed and, when possible, how to resolve itNstring 

Sample Response Success - Remove Description along with Name Update

[ { "code": "success", "details": ["string"], "campaignId": 1 } ]

Sample Response Failure - Remove Description along with Name Update

[   { "code": "failure", "details": [ "string" ], "campaignId": 1, "message": "string",
    "errors": [ { "field": "string", "errorType": "string", "description": "string" } ] } ]

Sample Response Success - Update Campaign Name

[ { "code": "success", "details": ["string"], "campaignId": 1 }
]

Sample Response Failure - Update Campaign Name

[ { "code": "failure", "details": [ "string" ], "campaignId": 1,    "message": "string",
    "errors": [ { "field": "string", "errorType": "string", "description": "string" } ] }
]

Sample Response Success - Update Multiple Campaigns

[ { "code": "success", "details": ["string"], "campaignId": 1 }, { "code": "success", "details": ["string"], "campaignId": 2 } ]

Sample Response Failure - Update Multiple Campaigns

[   { "code": "failure", "details": [ "string" ], "campaignId": 1,    "message": "string",
    "errors": [ { "field": "string", "errorType": "string", "description": "string" } ] },
{ "code": "failure", "details": ["string"],    "campaignId": 2,    "message": "string",
    "errors": [ { "field": "string", "errorType": "string", "description": "string" } ]
 }
]

Sample Response Success - Update KPI for a campaign

[ { "code": "success", "details": ["string"], "campaignId": 1 } ]

Sample Response Failure - Update KPI for a campaign

[   { "code": "failure", "details": [ "string" ], "campaignId": 1, "message": "string",
    "errors": [ { "field": "string", "errorType": "string", "description": "string" } ] } ]

Did this page help you?