REST API can GET, can't POST

Haroon2
New Member
3 1 0

 

Morning all

 

Seen this asked a few times and the answer is usually to stop sending cookies

If only life was that simple

 

I'm using WinInet from a legacy application - every GET works just fine - every POST returns HTML asking me to log in - doesn't make sense since I have a private app with all the required write access - the program flow is: -

 

09:27:18 ShopifyUpload clsHTTPS.OpenHTTPS clsShopifyApi.CreateProduct, server 'rangertest1.myshopify.com'
09:27:18 ShopifyUpload clsHTTPS.OpenHTTPS clsShopifyApi.CreateProduct opened connection to 'rangertest1.myshopify.com' using port 443
09:27:18 ShopifyUpload clsHTTPS.OpenHTTPS InternetSetOption replied True (good), INTERNET_OPTION_END_BROWSER_SESSION - this dumps any cookies
09:27:18 ShopifyUpload clsHTTPS.OpenHTTPS InternetSetOption replied True (good), my username
09:27:18 ShopifyUpload clsHTTPS.OpenHTTPS InternetSetOption replied True (good), my password
09:27:18 ShopifyUpload clsHTTPS.TalkToSite POST - have data
09:27:18 ShopifyUpload clsHTTPS.TalkToSite HttpAddRequestHeaders replied True (good), 'Authorization: Basic base64 user:password
09:27:18 ShopifyUpload clsHTTPS.TalkToSite HttpAddRequestHeaders replied True (good), 'Cache-Control: no-cache'
09:27:18 ShopifyUpload clsHTTPS.TalkToSite HttpAddRequestHeaders replied True (good), 'Content-Type: application/json; charset=utf-8'
09:27:18 ShopifyUpload clsHTTPS.TalkToSite opened a request to endpoint '/admin/api/2021-01/products.json'
09:27:18 ShopifyUpload clsHTTPS.mGetReply saw end of data
09:27:19 ShopifyUpload clsHTTPS.mDocQueryInfo returned: -

HTTP/1.1 200 OK
Date: Thu, 01 Apr 2021 08:27:26 GMT
Content-Type: text/html; charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive
X-Sorting-Hat-PodId: 45
X-Sorting-Hat-ShopId: 30967852
Vary: Accept-Encoding
Referrer-Policy: origin-when-cross-origin
X-Frame-Options: DENY
X-ShopId: 30967852
X-ShardId: 45
Cache-Control: no-store
Content-Language: en
X-Shopify-Login-Required: true
Shopify-Auth-Mechanisms: password
Strict-Transport-Security: max-age=7889238

09:27:19 ShopifyUpload clsHTTPS.TalkToSite had to wait for 0.4375 seconds
09:27:19 ShopifyUpload clsHTTPS.TalkToSite reply: -

<html> stuff asking me to login

 

I expect I'm missing something really obvious - please enlighten me

 

 

0 Likes