When I make a post request to the following URL in Postman, and pass the raw data below, I get a 201 status code and the price rule is created successfully. But, when I try the same thing with axios, the api returns a 200 status code and the response data is the html of the login page.
https://<apikey>:<password>@xxx.myshopify.com/admin/api/2020-07/price_rules.json
{
"price_rule": {
"title": "TESTPRICERULE2",
"target_type": "line_item",
"target_selection": "entitled",
"allocation_method": "across",
"value_type": "percentage",
"value": "-100.0",
"customer_selection": "all",
"usage_limit": "1",
"entitled_product_ids": ["5591610753175"],
"starts_at": "2020-09-02T17:59:10Z"
}
}
Here’s how I’m making the post request with axios:
const data = {
price_rule: {
title: "TESTPRICERULE2",
value_type: "percentage",
value: "-100.0",
entitled_product_ids: ["5591610753175"],
allocation_method: "across",
once_per_customer: "false",
usage_limit: "1",
customer_selection: "all",
target_type: "line_item",
target_selection: "entitled",
starts_at: new Date()
}
};
const url = "https://