In the POST method, the response status code is in the 200s, but the response comes back as HTML.

aoao
Tourist
10 0 1

I use RestAPI with MSXML 6.0 on Windows.

In case that you send a POST request and it is processed successfully, a help page says a response will be returned as JSON with 200s status code.

However, Though the following HTML is returned as the response along with 200s status code, the processing was not done correctly.

<html>
<body>
<noscript>
<a href="https://accounts.shopify.com/oauth/authorize?...{omitted}">continue</a>
</noscript>

<script type="text/javascript" defer>
window.location = "https:\/\/accounts.shopify.com\/oauth\/authorize?...{omitted}</script>
</body>
</html>

For example, I simply adjusted the inventory quantity in the inventory level adjust.json.
In the request, I inserted the parts of JSON fields into the body folloing the instruction of the help page.

The ContentType is set to application/json, and the charset is set to UTF-8.

When I try to add a new product in Product API, the HTML is returned as well and the process does not work properly. Nothing was created.

If anyone has experienced the same problem or has a solution, I would appreciate it.

by the way, GET, PUT and DELETE will be processed as expected and JSON is returned.

Replies 6 (6)
Jayvin
Shopify Partner
284 42 85

Hi,

It looks like your app has not yet been authorized correctly.

Go through  oauth process again, get authenticated correctly and make sure you have correct access token before making any calls to shopify rest api.

aoao
Tourist
10 0 1

Thank you for reply.
Actually, I almost agree with your perspective, but the requirment of authorization would meet as far as the help page I read.
https://shopify.dev/docs/admin-api/getting-started#authentication

We use not a public app but a private one that needs only password.
I authenticate using basic HTTP authentication.
But around PUT method, the generated access token based on OAuth needs expectionally? I'll try.

Jayvin
Shopify Partner
284 42 85

Hi,

If you are using private app, you do not need to authenticate. Just build the url endpoint as mentioned here and make the request.

I have not used MSXML services to make request to shopify rest api so I can't give you more infos on this

aoao
Tourist
10 0 1

Just only a simple authoentication so called basic auth needs for a private app. Thank you for reply.
I doubted a bug so I asked Shopify front support, As for them, there might be a problem if OAuth won't be completed.
I have yet to try it. I'll report the result something soon.

Daniel_Oblitas_
Shopify Partner
8 0 0
aoao
Tourist
10 0 1

I barely remember the moment I had just dealt with this end-boss.
Lucky you, there was the trace left here.
"X-Shopify-Access-Token" with your token would work for some reason, give it a try.