api:product:campaign:update
Table of Contents
API : Product campaign Update
Introduction
This request updates a campaign. Only the fields sent are changed, and a field sent with its current value is ignored, so the whole form can be sent. A request that changes nothing returns the campaign unchanged. See what can be changed.
- Not started: every field can be changed. A new start date cannot be in the past.
- Started:
name,startDate,months,wholesale,priceandresellersare locked.endDatecan only be moved earlier, and not to before today.messagecan be changed. - Stopped: nothing can be changed.
- A reseller's copy of a master campaign (
fromCampaignset):startDate,months,wholesaleandresellersfollow the master campaign and cannot be sent.endDatecan only be moved earlier.name,priceandmessageare the reseller's, with the same start lock as any campaign. - A master campaign with copies: the change is carried to the copies - see copies. If moving the master's window would make a copy overlap another campaign on its reseller product, the whole change is refused.
Request
| URL | https://api.telecomx.dk/product/PRODUCT_ID/campaign/CAMPAIGN_ID | ||
|---|---|---|---|
| Method | POST | ||
| Param | PRODUCT_ID | Id of the rateplan product holding the campaign | |
| Param | CAMPAIGN_ID | Id of the campaign | |
| Access level | RESELLER with write access to the reseller, for a reseller product. RESELLER_ADMIN with FINANCE feature or ADMIN for a master product. |
||
| Body | |||
| name | String | [optional] 1-64 characters. | |
| startDate | Date | [optional] First day of the enrolment window, as Copenhagen midnight. | |
| endDate | Date | [optional] Last day of the enrolment window, as Copenhagen midnight. | |
| months | Number | [optional] 1-12. | |
| wholesale | Number | [optional] 0-999999. RESELLER_ADMIN and ADMIN only. | |
| price | Number | [optional] 0-999999. | |
| message | String | [optional] Up to 1024 characters, or null. | |
| resellers | Array of Id | [optional] Master campaigns only, at least one reseller. | |
Example
POST https://api.telecomx.dk/product/60bf169291eb7e58090617a3/campaign/6aba6a8be5b8b45688b9faed { "endDate": "2026-10-14T22:00:00.000Z", "message": "Kampagnen slutter 15. oktober" }
Response
The campaign as it is after the update - the same fields as Create returns, plus fromCampaign on a reseller's copy.
Errors
Several validation errors at once are returned together as 422 multiple, with each error listed inside.
| Error code | Message | Description |
|---|---|---|
| 422 | <property> | Invalid input for the named property - the request body, query or URL parameter failed validation |
| 400 | bad_request | No campaign fields to update - the body was empty |
| 403 | access_denied | Insufficient access level |
| 403 | wholesale | Only a reseller admin may set the campaign's reseller price |
| 404 | not_found | Product not found |
| 404 | campaignId | Campaign not found on this product |
| 404 | resellers | The following resellers were not found: <ids> |
| 409 | type | Campaigns can only be created on MVNO and SIP rateplan products |
| 409 | inheritFromReseller | Campaigns cannot be created on a customer product - create it on the reseller product it inherits from |
| 409 | stoppedAt | The campaign has been stopped and can no longer be changed |
| 409 | <field> | The campaign has started - only the end date can be changed, and only to an earlier date |
| 409 | endDate | The end date of a started campaign can only be moved earlier |
| 409 | <field> | This campaign was taken over from a master campaign and follows it - only the name, the price and the message are its own |
| 409 | endDate | The end date of a campaign taken over from a master campaign can only be moved earlier |
| 409 | resellers | Resellers can only be selected on a master campaign |
| 409 | overlap | The enrolment window overlaps another campaign on this product - two campaigns open at the same time on one product cannot both apply |
| 409 | overlap | A reseller has taken this campaign over on product <id>, and moving the window would make it overlap another campaign on that product |
| 409 | concurrentChange | The campaign was changed by someone else while this request was being handled - reload and try again |
| 422 | startDate | The start date cannot be in the past |
| 422 | endDate | The end date cannot be in the past - stop the campaign to close it now |
| 422 | endDate | The end date cannot be before the start date |
| 422 | resellers | A master campaign must name at least one reseller - with none selected it would apply to nobody |
| 500 | internal_error | <Unspecified> |
api/product/campaign/update.txt · Last modified: by Thomas Andersen