Hello everyone,
I’ve created a private app in the Shopify Admin area. Download and upload work fine in Postman, but from my server, only the download works. When trying to upload data, I receive a 401 status code, and the shop data (categories) remain unchanged.
Can anyone tell me what might be causing this?
Could it be related to outdated SSL certificates, or have I missed something fundamental regarding authentication?
I’ve attached my code (JavaScript and comments) for reference:
// Produces 400 + 401
function uploadCategoriesSFY() {
var settings = {
"url": "https://shop123456.myshopify.com/admin/api/2023-10/custom_collections.json",
//"url": "https://110a...:321@shop123456.myshopify.com/admin/api/2023-10/custom_collections.json",
// Also returns a 401
"method": "POST",
"timeout": 0,
"headers": {
"X-Shopify-Access-Token": "sh.._de1123....",
//"X-Shopify-Access-Token" produces a 401
/*
Fri Feb 16 15:05:05 CET 2024: API RESPONSE: {
"responseCode": 401,
"errorResponse": "{\"errors\":\"[API] Invalid API key or access token (unrecognized login or wrong password)\"}"
}
*/
"Authorization": "Basic 456..",
/*
* // Authorization in the header produces a 400
Fri Feb 16 15:02:30 CET 2024: API RESPONSE: {
"responseCode": 400,
"errorResponse": "{\"errors\":{\"custom_collection\":\"Required parameter missing or invalid\"}}"
}
*/
"Content-Type": "application/json"},
"data": JSON.stringify({
"custom_collection": {
"title": "SSLTEST",
"body_html": "Description of the collection",
"sort_order": "manual",
"template_suffix": "your_template_suffix",
"published_scope": "web"
}
})
};
All the best,
Patrick