Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

ROR Shopify fulfillments api

ROR Shopify fulfillments api

WaelHoury
Tourist
5 0 1

i'm using the shopifyAPI::Fulfillments in my ruby on rails app, i have created a private app with the required access scopes, but for some reason i can't fetch or post a fulfillment, i keep getting 404 error
i checked order id and line item id and they are correct


@shopify_fulfillment = ShopifyAPI::Fulfillment.new(
          order_id: @shopify_order_id,
          status: 'success',
          tracking_number: @fulfillment.tracking_number,
          service: @fulfillment.tracking_service,
          line_items: build_fulfillment_line_items,
          location_id: location_id
        )

build_fulfillment_line_items return a hash of line items with id and quantity 
the exact error is: ActiveResource::ResourceNotFound Exception: Failed. Response code = 404. Response message = Not Found.

Replies 7 (7)

WaelHoury
Tourist
5 0 1

the exact message i get is:
ActiveResource::ResourceNotFound Exception: Failed. Response code = 404. Response message = Not Found.

tolgapaksoy
Shopify Partner
112 7 76

What version of shopify_api and shopify_app gems are you using?

 

The params you're passing to Fulfillment.new is outdated.

 

The oldest API version is 2022-10 and it does not support the params you're giving to Fulfillment.new: https://shopify.dev/docs/api/admin-rest/2022-10/resources/fulfillment#post-fulfillments

WaelHoury
Tourist
5 0 1

api version i'm using is 2023-07, i tried using this format:

fulfillment.tracking_info = {
  "number" => "1Z001985YW99744790",
  "company" => "UPS"
}
fulfillment.line_items_by_fulfillment_order = [
  {
    "fulfillment_order_id" => 1046000798,
    "fulfillment_order_line_items" => [
      {
        "id" => 1058737530,
        "quantity" => 1
      }
    ]
  }

but i got also the same issue.

tolgapaksoy
Shopify Partner
112 7 76

Are you actually using fulfillment orders though? They are something completely different from orders.

WaelHoury
Tourist
5 0 1

what do you mean exactly?
what i'm trying to do is:
sending orders from my platform to shopify, which is working fine, i can see the order there with all the details
and then if i fulfill the order i wanna create a fulfillment for that order in shopify as well
i'm able to create orders through api, and receive fulfillment updates through webhooks
but whenever i try to create a fulfillment through the api i can't

 

tolgapaksoy
Shopify Partner
112 7 76

You can't just start sending API requests like this without reading any docs on FulfillmentOrders 😅.

 

https://shopify.dev/docs/apps/fulfillment/migrate

 

You need to utilize FulfillmentOrders in order to create Fulfillments. Also ensure that you're running the latest versions of the "shopify_api" and "shopify_app" gems.

WaelHoury
Tourist
5 0 1

i have the correct access scopes.
i see that based on docs FulfillmentOrders doesn't have a create endpoint, which makes me confused a bit now after you stated "You need to utilize FulfillmentOrders in order to create Fulfillments".
can i get a bit more details on this please?