I want to create a fullfilment in a private shopify app, but instead of the expected json I get a HTML with a oauth login link returned. (see below)
what do I need to change?
Other Api’s like creating products do work
URL
POST https://{mySlug}.myshopify.com/admin/api/2021-10/orders/{orderid}/fulfillments> > I also tried> POST https://{apikey}:{password}@{mySlug}.myshopify.com/admin/api/2021-10/orders/{orderid}/fulfillments
Body
{“fulfillment”:{“location_id”:{locationid},“notify_customer”:false}}
Headers:
X-Shopify-Access-Token - {myAccessToken}
I’ve seen the following link
https://community.shopify.com/c/shopify-apis-and-sdks/post-returns-200-and-login-page/m-p/877771
Therefore i tried to to post with and without basic auth. Also I set “Cache-Control” to “max-age=0”
but same result.
I tried it with HTTP Client in C# and with postman directly. both same results. In the C# client I also explicitly disable cookiesC# Code creating the http client
var handler = new HttpClientHandler
{
UseCookies = false
};
var client = new HttpClient(handler);
client.DefaultRequestHeaders.Add("X-Shopify-Access-Token",accessToken);
client.DefaultRequestHeaders.Add("Cache-Control", "max-age=0");
Code to post to the api
var req = new RequestFulfillment.ShopifyFulFillmentRequest()
{
Fulfillment = new ()
{
LocationId = locationid,
NotifyCustomer = notifyCustomer
}
};
using var client = ResolveClient();
string content = JsonSerializer.Serialize(req);
try
{
var response = await client.PostAsync(url, new StringContent(content, Encoding.UTF8, "application/json"));
var respcontent = await response.Content.ReadAsStringAsync();
var responseDto = JsonSerializer.Deserialize<CreateFulfillmentResponse>(respcontent);
Response I get
200 OK but his thml
