Discussing APIs and development related to customers, discounts, and order management.
Hello,
I want to use the API to create custom discount codes. When sending a POST request to "/admin/api/2023-10/price_rules/1660066169167/discount_codes.json" it always returns a 200 and creates nothing. In request header I send the "X-Shopify-Access-Token" Parameter and my body looks like the following:
{
"discount_code": {
"code": "TEST1782387162387127"
}
}
I created the price rule simply with creating a discount code manually and deactivating it. I tried this because creating a price rule via API has the same result. Even when trying the example code, nothing happens.
I am using a custom private app which I created directly in my shop settings.
What am I doing wrong? Any help would be really appreciated.
Thank you in advance.
Best regards,
Alex
Hey @ets_shop
Are you able to capture the request ID from the response headers? I can check out the logs to see what's going on.
Scott | Developer Advocate @ Shopify
Hey @SBD_ ,
thank you for your fast reply. I have the following Request ID in header field "X-Request-ID": d704bc6f-d7be-47fe-86c4-190e80b3efcb
Thank you in advance.
Hey @ets_shop
Thanks for the request ID - That looks like a GET request. Are you able to capture a request ID of the failing POST/creation?
Scott | Developer Advocate @ Shopify
Hey @SBD_ , thanks for the reply. I am pretty sure that it was the POST request. Here is another request ID: 8bf84edb-74ea-4d34-9336-2cc6f937acb4. A GET request to the same URL results in an Error 400.
Thank you very much.
Hey @ets_shop
Thanks for your patience. Can you please provide another ID? Our logs only retain a few days. Thanks
Scott | Developer Advocate @ Shopify
Hi @SBD_ , no problem. Here is another ID: ddefe3a0-389a-42a7-aec1-a71977e7935d
Thank you for your help.
Best,
Alex