collect api error

nisystem
New Member
2 0 0

url : https://myshop.myshopify.com/admin/api/2021-04/collects.json

method : post

body :

{
"collect": {
"product_id": 6728401748166,
"collection_id": 270312571078
}
}
 
response :
<html>

<body>
<noscript>
<a
</noscript>

<script type="text/javascript" defer>
window.location = "https:\/\/accounts.shopify.com\/oauth\/authorize?client_id=7ee65a63608843c577db8b23c4d7316ea0a01bd2f7594f8a9c06ea668c1b775c\u0026destination_uuid=ad5df46b-a54c-44c5-a9a4-1d54fd24876c\u0026nonce=e80513925f404899a5db1b75d104d61b\u0026prompt=merge\u0026redirect_uri=https%3A%2F%2Ftongya-sp.myshopify.com%2Fadmin%2Fauth%2Fidentity%2Fcallback\u0026response_type=code\u0026scope=email%20https%3A%2F%2Fapi.shopify.com%2Fauth%2Fdestinations.readonly%20openid%20profile%20https%3A%2F%2Fapi.shopify.com%2Fauth%2Fpartners.collaborator-relationships.readonly%20https%3A%2F%2Fapi.shopify.com%2Fauth%2Fbanking.manage%20https%3A%2F%2Fapi.shopify.com%2Fauth%2Fshopify-chat.admin.graphql%20https%3A%2F%2Fapi.shopify.com%2Fauth%2Fflow.workflows.manage\u0026state=a39072febeb025a44a3c2a135b1db7dd\u0026ui_locales=en\u0026ux=shop%20new_design_language";
</script>
</body>

</html>
 

I wrote some APIs according to the sample, but the html source is returned.

Why is that?

I don't know the information even if I go into that link.

0 Likes
Speedimize
Shopify Partner
292 47 123

Hi @nisystem 

Aibek is here from Speedimize.io

Maybe this can help you: 

You have received a response from shopify that you are not authorized to make API requests.

If you send post requests from the browser, then try to open any request to the Shopify API in a new tab, and you will open a window for authorization. After completing the login, the session will be saved in the cookies of your browser, and you will then be able to make requests to the API.

If you are trying to make requests from outside (not from the browser), then you need to get an access token. For more information on how to get it, you can see the link:
https://www.shopify.com/partners/blog/17056443-how-to-generate-a-shopify-api-token 

Hope that helps you.

We Speedimize your store
Have a problem with speed performance, send me email here: hello@speedimize.io


If our advice was helpful please LIKE or ACCEPT SOLUTION