Created
May 18, 2022 15:25
-
-
Save ikraamg/6b8cff00ec4d74250c564bb9895fe03f to your computer and use it in GitHub Desktop.
Dynamic Promotion API example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl --location --request PUT 'http://localhost:3000/api/orders/CHORD-579656375/line_items/41' \ | |
--header 'X-Spree-Order-Token: QDpqfwxE2eaUr7oo41B6Zw' \ | |
--header 'Content-Type: application/json' \ | |
--data-raw '{ | |
"sku": "product-6", | |
"quantity": 3, | |
"dynamic_promotions_attributes": [ | |
{ | |
"code": "existing_code_to_destroy", | |
"_destroy": 1 | |
}, | |
{ | |
"code": "new_code" | |
} | |
], | |
"metadata": { | |
"metadata": 1234567890 | |
} | |
}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl --location --request PUT 'http://localhost:3000/api/orders/CHORD-579656375' \ | |
--header 'X-Spree-Order-Token: <TOKEN>' \ | |
--header 'Content-Type: application/json' \ | |
--data-raw '{ | |
"order": { | |
"line_items_attributes": [ | |
{ | |
"sku": "product-2", | |
"quantity": 8, | |
"dynamic_promotions_attributes": [ | |
{ | |
"code": "new_code" | |
// "_destroy": 1 | |
}, | |
{ | |
"code": "new_new_code" | |
} | |
], | |
"metadata": { | |
"some_metadata": 1234567890 | |
} | |
} | |
] | |
} | |
}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment