PHP API Calls - Inventory Levels

Highlighted
New Member
2 0 1

Hello All,

We are setting up an app using PHP for our customers to drop ship from their Shopify store where we will then fill the order from our warehouse. We therefore need to use the API to communicate between our customers Shopify stores via our app, and our system. We have managed to create a webhook through the API for when orders are created Shopify sends us the info from the order so we can fill the order. However, we are having difficulty with the next API call.

//vars

$shop = "my shop"

$token = "123546"

$query = array(
"Content-type" => "application/json"
);
$api_endpoint = "/admin/api/2020-04/inventory_levels/adjust.json";

// build details

$query = array("Content-type" => "application/json",
       "location_id" => "123456789",
       "inventory_item_id" => "123456789",
       "available_adjustment" => "100");

//Run API call
$inv_levels = shopify_call($token, $shop, $api_endpoint, $query, 'POST');

The part I am stuck on, is the API docs on Shopify point to the above set up. However, when I try find the answer on forums and Google, I keep ending back at cURL.

What is the best way to setup API calls for both POST and GET?

The two we aim to set up:

1. The inventory_levels, so we can update the Shopify stores with our current inventory levels at our warehouse. (we plan to do this at scheduled intervals)

2. Sending info back to the Shopify stores telling the end user the goods are on the way, and a tracking number attached.

 

Any info on this would be greatly appreciated!

 

Thanks Team!

 

Dan

0 Likes