What's your biggest current challenge? Have your say in Community Polls along the right column.

GraphQL: inventoryMoveQuantities: What do I put in "referenceDocumentUri"?

Solved

GraphQL: inventoryMoveQuantities: What do I put in "referenceDocumentUri"?

Moritz-PV
Shopify Partner
14 1 8

See documentation here: https://shopify.dev/docs/api/admin-graphql/2024-10/mutations/inventoryMoveQuantities

 

There is no documentation ANYWHERE what referenceDocumentUri should be.
The explanation there tells me NOTHING:

A freeform URI that represents why the inventory change happened. This can be the entity adjusting inventory quantities or the Shopify resource that's associated with the inventory adjustment. For example, a unit in a draft order might have been previously reserved, and a merchant later creates an order from the draft order. In this case, the referenceDocumentUri for the inventory adjustment is a URI referencing the order ID.

I simply want to make inventory adjustments, for safety stock. I don't have a "document" to point to. What should I put here? I tried to fill in just the public https URL of our online store to have something in this required field, but of course get the error "The specified reference document is invalid."
Where the hell am I supposed to come up with some bogus document ID that is accepted?


Also: This forum is just as terribly organized as the documentation. Where am I supposed to post this? I now put it in the general "Shopify Discussion" with the label "Troubleshooting". I thought "Shopify Apps" could be fitting as well, or "Shopify Plus" since we are using Shopify Plus. But there I could not choose fitting labels. I hope this is in a place where I can find answers.

Accepted Solution (1)

Moritz-PV
Shopify Partner
14 1 8

This is an accepted solution.

Okay, through trial and error I found that I can use the app's id "gid://shopify/App/..." for "referenceDocumentUri".
This can be retrieved like this:

{
    currentAppInstallation {
      app {
        id
      }
    }
  }
}

 

Another question mark was then the "ledgerDocumentUri" required in quantity changes other than for "available". I just took "uri://example.com/some/external/reference" from some unexplained examples given by others in this forum. But I find it quite annoying that I have to put some bogus "URI" there with some schema that makes no sense to me and there is no documentation about what it is supposed to mean. It works, but it's bull**bleep**.

Shopify should document their APIs.

View solution in original post

Reply 1 (1)

Moritz-PV
Shopify Partner
14 1 8

This is an accepted solution.

Okay, through trial and error I found that I can use the app's id "gid://shopify/App/..." for "referenceDocumentUri".
This can be retrieved like this:

{
    currentAppInstallation {
      app {
        id
      }
    }
  }
}

 

Another question mark was then the "ledgerDocumentUri" required in quantity changes other than for "available". I just took "uri://example.com/some/external/reference" from some unexplained examples given by others in this forum. But I find it quite annoying that I have to put some bogus "URI" there with some schema that makes no sense to me and there is no documentation about what it is supposed to mean. It works, but it's bull**bleep**.

Shopify should document their APIs.