Jet.com is an e-commerce platform, which provides a powerful marketplace to his partners. But products listing on Jet.com is not quite simple as other platforms. To upload products on Jet.com, first, you need to register their Partner program. After receiving approval, you will able to access Jet API to upload products.
You can also check our ready Jet API template, using this tool you can easily manage products and orders on Jet.com.
Start Product Listing in Jet.com via API call
Initially, you have Test API environment access. After login in the Jet partner account, go in the API tab at the left side. Where you can find Test API keys, which are going to use for authentication.
Jet API Authentication:
Send API user and merchant pass in the request body to authenticate Jet API. Use below PHP code to authenticate. After that, you will get id_token, which will pass in the header to execute further API calls.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
<?php $url = "https://merchant-api.jet.com/api/token"; $data = array( 'user' => '2BD8*******************B06A7AC', 'pass' => 'WJTa*******************jHPxecL' ); $body = json_encode($data); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); curl_setopt($ch, CURLOPT_POSTFIELDS, $body); curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY); curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json')); $code = curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $res = curl_exec($ch); $resultdata=json_decode($res); // get jet token here echo $token = $resultdata->id_token; ?> |
Jet API Call to Add Product Sku:
Now you have the id_token, lets write a code to add products SKU in Jet.com. Complete SKU Products parameter information described here: https://developer.jet.com/docs/overview
Need to Implement This : Get Quote
Pass previously get authentication id_token in header request. Make sure the content type is JSON. Below request product parameters are required to upload SKU.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
$headers = array( "Content-Type: application/json", "Authorization: Bearer ".$token ); $prod_url = "https://merchant-api.jet.com/api/merchant-skus?sku=788546457322"; $standard_product_codes[] = array( "standard_product_code" => "788546457322", "standard_product_code_type" => "UPC"); $prod_data = array( "product_title" => "Product Title", "multipack_quantity" => 8, "brand" => "Brand Name", "standard_product_codes" => $standard_product_codes, // If you ASIN code use instead of UPC code "main_image_url" => "https://example.com/assets/image.png", ); $pro_body = json_encode($prod_data); $chnew = curl_init(); curl_setopt($chnew, CURLOPT_URL, $prod_url); curl_setopt($chnew, CURLOPT_HTTPHEADER, $headers); curl_setopt($chnew, CURLOPT_CUSTOMREQUEST, "PUT"); curl_setopt($chnew, CURLOPT_POSTFIELDS, $pro_body); curl_setopt($chnew, CURLOPT_HTTPAUTH, CURLAUTH_ANY); curl_setopt($chnew, CURLOPT_RETURNTRANSFER, true); $result = curl_exec($chnew); $product_data=json_decode($result); |
After executing the above code new Product SKU added in Jet.com. Although Jet has another method to upload products, that is the Bulk JSON File Upload method. This method used to upload large number of products at one time. If you have limited products then a single SKU method is best.
You May Also Like:
How to Add New Product in Bigcommerce via API V2
How to Connect With Cloudshare Rest API
How to Get Opportunity Data from Salesforce Through API in PHP
How to Install Magento Security Patch via Putty
Code to Use Paypal Payment Gateway on Website
After adding SKU in jet com, use this same method to add Inventory and Price data of products. Your added product status goes to Under Review. After reviewing uploaded products by Jet, your SKU goes live. Must share with others. Thanks
It’s a pity you do781&2#n;t have a donate button! I’d without a doubt donate to this excellent blog! I suppose for now i’ll settle for bookmarking and adding your RSS feed to my Google account. I look forward to new updates and will share this website with my Facebook group. Chat soon!
Hi
I did the same that you mention in your above script regarding to the create new product on jet but it did not work for me . after run this it return nothing and did not create any product on my account.
can you please let me know what I did wrong.
Hi Pawan,
Mentioned script is 100% working and tested. I think you issue in your request parameters. Cross check it again, it should work.
yes the code works, however i needed to not verify SSL
my issue is i am stuck on the upload sku invitory how do i get the object array too json
how does the object array look
Hi Allen, making object array to json quite easy. See this example:
$inventory[] = array(
‘fulfillment_node_id’ => ‘cf0d2b2**********1a96117598c’,
‘quantity’ => ’10’
);
$inv_data = array(
‘fulfillment_nodes’ => $inventory
);
$inv_body = json_encode($inv_data);