Creating Fulfillment Service via API

Solved
Highlighted
New Member
4 0 0

I have been successfully testing a number of endpoints via Postman. However, I am  now attempting to create a new fulfillment service and not having much luck. I am hitting the "/admin/fulfillment_services.json" endpoint, and my base url is comprised of my API Key and Password.

 

Body

{
  "fulfillment_service": {
    "name": "<name>",
    "callback_url": "<url>",
    "inventory_management": true,
    "tracking_support": true,
    "requires_shipping_method": true,
    "format": "json"
  }
}

 

The response is a bit of html. Any thoughts?

 

0 Likes
Shopify Staff
Shopify Staff
297 32 59

Hey Shane,

 

As per this thread, Shopify blocks POST requests with Basic Auth that have cookies to prevent Cross-Site Request Forgery (CSRF) attacks.

 

Can you double check to ensure that you're not passing in any cookies with your request? Removing them should help solve the issue you're facing.

0 Likes
New Member
4 0 0

Hey Zameer, 

 

Thanks for the reply. I removed the cookies from the Postman request, and now receive the following error:

 

"errors": "[API] Invalid API key or access token (unrecognized login or wrong password)"

 

I'm using the same base url that is working for my other requests. Is there an additional token necessary for this particular endpoint? If so, where can  I obtain one?

0 Likes
Shopify Staff
Shopify Staff
297 32 59

Hey Shane,

 

That sounds quite odd.

 

Can you please share the Request Id found in the response header? I'll take a look to see what the issue could be.

0 Likes
New Member
4 0 0

Appreciate it, Zameer! 

 

X-Request-Id ba14bc15-f9ea-4554-b498-1f6a6bf18b1e
0 Likes

Success.

Shopify Staff
Shopify Staff
297 32 59

Hey Shane,

 

Testing with your development shop, it's definitely possible to create a fulfillment service using the private API credentials you are given in your admin.

 

Can you please double check the API key and secret values you are using in your request and then try again? It may be just a typo which is giving you trouble.

0 Likes
New Member
4 0 0

Thanks, Zameer. When I was trying to solve my original problem (before removing the cookies) I had added unnecessary headers in my Postman request which was causing the last problem. 

0 Likes