Learn how to configure coreBOS and Shopify to work together.
GET/POST information (products,accounts,orders)from coreBOS to Shopify and from Shopify to coreBOS
This document explains how to successfully call the Shopify API with coreBOS in order to get or post information. The first thing you need before receiving or submitting information to Shopify is the URL of Shopify from the client and the access token.
The access token can be generated by following the steps in this link
To get information from Shopify, you will need the specific id of the account or product stored in Shopify for example: if you want to get an account from Shopify into coreBOS you need to have an account id and then you can get the data of that account.
Identification of the Endpoint Admin REST API endpoints are organized by resource type. You’ll need to use different endpoints depending on your app’s requirements.
Version API Shopify releases a new API version every 3 months at the beginning of the quarter. Version names are date-based to be meaningful and semantically unambiguous
Endpoint: | All Admin REST API endpoints follow this pattern: https://{store_name}.myshopify.com/admin/api/{versionAPI}/ {resource}.json |
---|---|
Access Token: | The access token can be generated by following the steps in this link |
The Product resource lets you update and create products in a store. Every product has a unique ID. Each id is unique across the Shopify system. No two products will have the same id. To retrieve a product from Shopify you need to store this id in a field and use it whenever you want. Besides the ID you also need the access token to generate the products.
Purpose: | Retrieve a product from Shopify to coreBOS |
---|---|
WS Name: | Get products |
Type: | Get |
Target Module: | Products |
Parameters: | Header: X-Shopify-Access-Token : {access_token} Content-Type : application/json Body:To retrieve the product from Shopify you need the id of the product. This id is stored in a corebos field. To use it you need to copy the value of the field in the variable in the URL. Response:You need to map the response fields,that you want to update from Shopify, with the relevant fields of your coreBOS1). |
URL Format | https://{store_name}.myshopify.com/admin/api/{versionAPI}/ {resource}.json |
Access Token : your_super_secret_key
Format : https://yourshop.myshopify.com/admin/api/2022-04/products/$prod_id
The value of the variable prod_id is taken with the following code
<fieldname>prod_id</fieldname>
<Orgfields><Orgfield>
<OrgfieldName>concat(shopifyprodid,'.json')</OrgfieldName>
<OrgfieldID>expression</OrgfieldID>
Shopify Field | coreBOS Field | Description | Mandatory | Type of field | Example |
---|---|---|---|---|---|
product.title | productname | Product Name | Yes | varchar | Rosé Charmat |
product.body_html | description | A short description of the product | No | varchar | Vino rosato spumante - CLIENTI DIRETTI |
product.product_type | productcategory | The product category | No | varchar | Spumanti |
The Customer resource lets you update and create customers in a store. Every customer has a unique ID. Each id is unique across the Shopify system. No two customers will have the same id. To retrieve a customer from Shopify you need to store this id in a field and use it whenever you want. Besides the ID you also need the access token to generate the customers.
Purpose: | Retrieve a customer from Shopify to coreBOS |
---|---|
WS Name: | Get customer |
Type: | Get |
Target Module: | Organizations |
Parameters: | Header: X-Shopify-Access-Token : {access_token} Content-Type : application/json Body:To retrieve the customers from Shopify you need the id of the customer. This id is stored in a corebos field. To use it you need to copy the value of the field in the variable in the URL. Response:You need to map the response fields,that you want to update from Shopify, with the relevant fields of your coreBOS1). |
URL Format | https://{store_name}.myshopify.com/admin/api/{versionAPI}/ {resource}.json |
Example Access Token : your_super_secret_key
Format : https://yourshop.myshopify.com/admin/api/2022-04/customers/$clientid
The value of the variable clientid is taken with the following code
<fieldname>clientid</fieldname>
<Orgfields><Orgfield>
<OrgfieldName>concat(client_id,'.json')</OrgfieldName>
<OrgfieldID>expression</OrgfieldID>
Shopify Field | coreBOS Field | Description | Mandatory | Type of field | Example |
---|---|---|---|---|---|
customer.email | email1 | Customer Emai | Yes | varchar | Rosé Charmatt |
customer.last_name | accountname | Account Name | No | varchar | Vino rosato spumante - CLIENTI DIRETTI |
customer.phone | phone | Customer Phone | No | varchar | Spumanti |
customer.addresses.0.address1 | ship_street | The customer address | No | varchar | Via Regina 33 |
customer.addresses.0.city | ship_city | The customer address | No | varchar | Porto Picena |
customer.addresses.0.province | ship_state | The customer address | No | varchar | MC |
customer.addresses.0.country | ship_country | The customer address | No | varchar | Australia |
customer.addresses.0.zip | ship_code | The customer address | No | varchar | 6558 |
The Orders resource lets you update and create orders in a store. Every order has a unique ID. Each id is unique across the Shopify system. No two orders will have the same id. To retrieve an order from Shopify you need to store this id in a field and use it whenever you want. Besides the ID you also need the access token to generate the products. This webservice will be a little different from the others due to the fact that we have related modules and information that will be stored in both modules. To do this, a workflow must be created which will perform an upsert to the related module. The upsert_data variable is used to store the ws response with the corresponding field.
Example of the wf:
The upsert task:
Purpose: | Retrieve an order from Shopify to coreBOS |
---|---|
WS Name: | Get order |
Type: | Get |
Target Module: | Organizations |
Parameters: | Header: X-Shopify-Access-Token : {access_token} Content-Type : application/json Body:To retrieve the order from Shopify you need the id of the order. This id is stored in a corebos field. To use it you need to copy the value of the field in the variable in the URL. Response:You need to map the response fields,that you want to update from Shopify, with the relevant fields of your coreBOS1). |
URL Format | https://{store_name}.myshopify.com/admin/api/{versionAPI}/ {resource}.json |
Access Token : your_super_secret_key
URL Format : https://yourshop.myshopify.com/admin/api/2022-04/orders/$order_id
The value of the variable clientid is taken with the following code
<fieldname>order_id</fieldname>
<Orgfields>
<Orgfield>
<OrgfieldName>concat(shopifyordid,'.json')</OrgfieldName>
<OrgfieldID>expression</OrgfieldID>
Shopify Field | coreBOS Field | Description | Mandatory | Type of field |
---|---|---|---|---|
order.id | getorederresponse | Order ID | No | varchar |
order.line_items | upsert_data | A variable that store the ws response field | Yes | varchar |
Unlike the Get method, the Post method has a different format. It has the same header structure, with the content-type and access token, but it also has a body structure. To send a product from coreBOS to Shopify you must map the fields you want to send from coreBOS to the fields that are in Shopify. Be careful with mandatory fields!
Purpose: | Send products information from coreBOS to Shopify, Create a new product |
---|---|
WS Name: | Post products |
Type: | Post |
Target Module: | Products |
Parameters: | Header: X-Shopify-Access-Token : {access_token} Content-Type : application/json Body:The product information that you want to send eg: { "product":{ "title":"Burton Custom Freestyle 151", "body_html":"Good snowboard!", "vendor":"Burton", "product_type":"Snowboard" }} |
URL Format | https://{store_name}.myshopify.com/admin/api/{versionAPI}/ {resource}.json |
To send a customer from coreBOS to Shopify you must map the fields you want to send from coreBOS to the fields that are in Shopify. Be careful with mandatory fields!
Purpose: | Send customers information from coreBOS to Shopify, Create a new customer |
---|---|
WS Name: | Post customer |
Type: | Post |
Target Module: | Organizations |
Parameters: | Header: X-Shopify-Access-Token : {access_token} Content-Type : application/json Body:The customer information that you want to send eg: { "customer":{ "first_name":"Steve", "last_name":"Lastnameson", "email":"steve.lastnameson@example.com", "phone":"+15142546011", "verified_email":true, "addresses":[ { "address1":"123 Oak St", "city":"Ottawa", "province":"ON", "phone":"555-1212", "zip":"123 ABC"}]}} |
URL Format | https://{store_name}.myshopify.com/admin/api/{versionAPI}/ {resource}.json |
An order is a customer's request to purchase one or more products from a shop. You can create, retrieve, update, and delete orders using the Order resource. To send an order from coreBOS to Shopify you must map the fields you want to send from coreBOS to the fields that are in Shopify. Be careful with mandatory fields!
The creation of a new order has a different structure from the others because it is not only fields from SalesOrder that must be sent, but also fields from related modules. Therefore, besides the web service mapping, you will also need another map of the Mapping type to make a relation of the corebos fields that you must send with the shopify fields.
Map
Fields map:
Shopify Field | coreBOS Field | Description | Type of field | Example |
---|---|---|---|---|
name | usageunit | Order name | varchar | Rosé Charmatt |
variant_id | inventorydetails_no | Order ID | varchar | Vino rosato spumante - CLIENTI DIRETTI |
quantity | quantity | Quantity of products | NN | Spumanti |
price | listprice | Price | NN | Via Regina 33 |
title | description | A short description | varchar | Porto Picena |
WS Mapping:
Purpose: | Send orders information from coreBOS to Shopify, Create a new order |
---|---|
WS Name: | Post orders |
Type: | Post |
Target Module: | SalesOrder, related to InvontoryDetails |
Parameters: | Header: X-Shopify-Access-Token : {access_token} Content-Type : application/json Body:The order information that you want to send eg: { "order":{ "line_items":[ { "variant_id":447654528, "quantity":1, "price":50, "name":"Prosecco", "title":" Prosecco DOC Treviso extra dry - CLIENTI DIRETTI" }]}} |
URL Format | https://{store_name}.myshopify.com/admin/api/{versionAPI}/ {resource}.json |