1 /**
2 * @oas [post] /admin/campaigns/{id}
3 * operationId: PostCampaignsId
4 * summary: Update a Campaign
5 * description: Update a campaign's details.
6 * x-authenticated: true
7 * parameters:
8 * - name: id
9 * in: path
10 * description: The campaign's ID.
11 * required: true
12 * schema:
13 * type: string
14 * - name: fields
15 * in: query
16 * description: Comma-separated fields that should be included in the returned data. if a field is prefixed with `+` it will be added to the default fields, using `-` will remove it from the default
17 * fields. without prefix it will replace the entire default fields.
18 * required: false
19 * schema:
20 * type: string
21 * title: fields
22 * description: Comma-separated fields that should be included in the returned data. if a field is prefixed with `+` it will be added to the default fields, using `-` will remove it from the default
23 * fields. without prefix it will replace the entire default fields.
24 * externalDocs:
25 * url: "#select-fields-and-relations"
26 * security:
27 * - api_token: []
28 * - cookie_auth: []
29 * - jwt_token: []
30 * requestBody:
31 * content:
32 * application/json:
33 * schema:
34 * allOf:
35 * - type: object
36 * description: The campaign's details.
37 * required:
38 * - description
39 * - starts_at
40 * - ends_at
41 * properties:
42 * name:
43 * type: string
44 * title: name
45 * description: The campaign's name.
46 * campaign_identifier:
47 * type: string
48 * title: campaign_identifier
49 * description: The campaign's identifier.
50 * description:
51 * type: string
52 * title: description
53 * description: The campaign's description.
54 * budget:
55 * type: object
56 * description: The campaign's budget.
57 * required:
58 * - limit
59 * properties:
60 * limit:
61 * type: number
62 * title: limit
63 * description: The campaign budget's limit.
64 * starts_at:
65 * type: string
66 * title: starts_at
67 * description: The campaign's start date.
68 * format: date-time
69 * ends_at:
70 * type: string
71 * title: ends_at
72 * description: The campaign's end date.
73 * format: date-time
74 * promotions:
75 * type: array
76 * description: The campaign's promotions.
77 * items:
78 * type: object
79 * description: The promotions to add to the campaign.
80 * required:
81 * - id
82 * properties:
83 * id:
84 * type: string
85 * title: id
86 * description: A promotion's ID.
87 * - type: object
88 * description: The campaign's details.
89 * properties:
90 * additional_data:
91 * type: object
92 * description: Pass additional custom data to the API route. This data is passed to the underlying workflow under the `additional_data` parameter.
93 * description: The campaign's details.
94 * x-codeSamples:
95 * - lang: JavaScript
96 * label: JS SDK
97 * source: |-
98 * import Medusa from "@medusajs/js-sdk"
99 *
100 * export const sdk = new Medusa({
101 * baseUrl: import.meta.env.VITE_BACKEND_URL || "/",
102 * debug: import.meta.env.DEV,
103 * auth: {
104 * type: "session",
105 * },
106 * })
107 *
108 * sdk.admin.campaign.update("procamp_123", {
109 * name: "Summer Campaign"
110 * })
111 * .then(({ campaign }) => {
112 * console.log(campaign)
113 * })
114 * - lang: Shell
115 * label: cURL
116 * source: |-
117 * curl -X POST '{backend_url}/admin/campaigns/{id}' \
118 * -H 'Authorization: Bearer {jwt_token}' \
119 * -H 'Content-Type: application/json' \
120 * --data-raw '{
121 * "description": "{value}",
122 * "starts_at": "2024-08-10T14:44:10.530Z",
123 * "ends_at": "2024-07-13T17:45:37.462Z"
124 * }'
125 * tags:
126 * - Campaigns
127 * responses:
128 * "200":
129 * description: OK
130 * content:
131 * application/json:
132 * schema:
133 * $ref: "#/components/schemas/AdminCampaignResponse"
134 * "400":
135 * $ref: "#/components/responses/400_error"
136 * "401":
137 * $ref: "#/components/responses/unauthorized"
138 * "404":
139 * $ref: "#/components/responses/not_found_error"
140 * "409":
141 * $ref: "#/components/responses/invalid_state_error"
142 * "422":
143 * $ref: "#/components/responses/invalid_request_error"
144 * "500":
145 * $ref: "#/components/responses/500_error"
146 * x-workflow: updateCampaignsWorkflow
147 * x-events: []
148 *
149 */
150