Api api/2023-04/price_rules.json return array instead an single object

Hi, im trying to use the api:

[POST] https://{domain}/admin/api/2023-04/price_rules.json

as specified here: https://shopify.dev/docs/api/admin-rest/2023-04/resources/pricerule#post-price-rules

but im receiving an array with all codes instead the created price rule.
i can confirm that no creating any price rule at all.

Can you help me with that? Follow de request id.
X-Request-ID: 47a1cdd5-ca53-44c5-930d-9dfbef354318

Tks

Hi there :waving_hand:

When I review the logs for that X-request-id, it is a request being made to GET "/admin/api/2023-04/price_rules.json
So that would make sense that it is returning a list of Price Rules.

Do you have the code for the request that you are trying to make that you would like me to review?

Im Just checked out that i sending a post request.

Im using postman just to make sure everything is fine, follow the screenshot

If this is not working could you share

  1. The request body
  2. The request response
  3. The X-request-id

Hi, thanks for your help. I have the same problem and right now. I’m using POST method, my body:

const requestBody = {
price_rule: {
title: ‘TEST10’,
target_type: ‘line_item’,
target_selection: ‘entitled’,
entitled_product_ids: [5419639406749, 8167846412514],
allocation_method: ‘across’,
value_type: ‘percentage’,
value: -10.0,
usage_limit: 1,
starts_at: isoStartDate,
ends_at: isoEndDate,
customer_selection: ‘all’
}
};
the request response is far to big for me to send it here but it’s an array of existing price rules (and my price rule isnt in it), other than that, it’s just typical price rules.
endpoint:

https://{domain}/admin/api/2023-07/price_rules.json
X-Request-Id: e54bf548-5fdb-4259-8f53-cdb1e7db694f

Access scopes:

  • read/write price rules
  • read/write discount codes
  • read analytics

Hello,

I’m facing the same issue. anyone were able to solve it?

Nothing so far.. we terminating declining the customer contract because of this bug.

it turns out it only happens when we call the main domain but it doesn’t happen when we call myshopify domain. so probably a bug on the redirection where the POST requests end up turning into GET requests