Brightpearl API Part III: Working with Resources

This is the third posting regarding the Shopify / Brightpearl API
Part I is located here.
Part II is located here.

The Brightpearl API describes resources that can be queried using an HTTP GET request. Resources look suspiciously like tables in a database.  The Brightpearl resources include: 

Return contact information for a single contract with the ID of #200 
Recall that each of the GET calls above require a valid authorization code to be included in the call as a header 
brightpearl-auth: xxxxxx-xxxxxxx-xxxxxxxx-xxxxxxx-xxxxxxxxxx
Also, that you’d replace myaccountid with the name of your Brightpearl account. 
Since the order returns only the contact ID,  we need to go to contacts to get the person’s name. 
Since the contact only returns the person’s first and last name, we need to go to the address object to get the address. 
So one way that this might work….    
Dimension an array arWorldShip[10], which will hold the following pieces of information: 
order number, contact id, firstName, lastName, address id, address1, address2, address3, address4, postal code, 
Query to get the orders for the day, and then loop through each order 
For each shop order:  
     Store the order number in an arWolrdShip[1]  and the contact ID in arWorldShip[2]
     Query for the customer – to get the first and last name, and address ID
     Store these in the array 
     Query for the address – to get the address information.  (oh and check…for shipping/vs. postal address). 
     Store these in the array 
Next shop order 
Write out the array variables as a record; converting to .DBF.  

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s