Integrations

Upload Local Items via API

How to use the new Local Item endpoint to update Local Items via API.

Introduction

This article outlines two changes that have been made to iQuote and to CloudLink’s API to allow Local Items to be updated via API. These changes are as follows:

  1. Local Item ID Added to iQuote
    A “Local Item ID” column has been added to the Local Items table in iQuote.
  2. Local Item Upload Endpoint
    A new Local Item Upload endpoint has been added to CloudLink’s API. This endpoint allows you to get, create, update, and delete/deactivate Local Items via API.

Local Item ID Added to iQuote

A “Local Item ID” column has been added to the Local Items table in iQuote. This column allows you to see the ID of Local Items in your system. This value corresponds to the “LocalItemId” field in the Local Item Upload endpoint, and is therefore required to update or delete an Item via API.

To view this column, open iQuote, then select a product from the top menu. Select “Model Config” under “Base Model” in the left side menu, then click on the “Local Items” tab. Local Items are automatically assigned a unique ID when they are first created.

iQuote - Local Items ARROW 2

Local Item Endpoint

A new “Local Item” endpoint has been added to CloudLink’s API. This endpoint allows you to get, create, update, and delete Local Items via API. 

Authentication

The Local Item endpoint represents the first of a new generation of CloudLink APIs built on OAuth 2.0. In order to interact with this endpoint, you will need an access token. This token can be obtained by calling the /auth/v2/oauth/token endpoint.

This endpoint serves to authenticate the user at the beginning of an API session. It accepts a client_id, client_secret, and tenant as input, and outputs an access_token used for subsequent API calls.


Endpoint URL

Asia Pacific tenants: https://au-api.cloudlink.texadasoftware.com/auth/v2/oauth/token
North America Region tenants: https://use-api.cloudlink.texadasoftware.com/auth/v2/oauth/token


client_id and client_secret

In order to call this method, you will need a unique client_id and client_secret. These values serve as your access credentials for the API, and must be provided to you by a member of Texada staff. To be given a client_id and client_secret, please contact Texada support.


tenant

This method also requires your company’s tenant value. This can be seen in your browser URL whenever you access CloudLink: the tenant value is the name of your organization found between the first set of forward slashes after “texadasoftware.com”. In the example below, the tenant value is ‘demo’:

CloudLink Url - CloudLink API Center - tenant value

Input

Header:
tenant [your company’s tenant value]

Body:
client_id [your client_id]
client_secret [your client_secret]
grant_type client_credentials


Output

Body:
access_token
[your access token]
expires_in [the number of seconds for which the token is valid]
token_type Bearer

Local Items (GET)

The GET method of the Local Item endpoint allows you to fetch either a single Local Item or all Local Items. It accepts a tenant and access_token as input, and outputs one or more Local Item objects.


Endpoint URL

Asia Pacific tenants: https://au-api.cloudlink.texadasoftware.com/v2/quotes/local-items/[ID]
North America Region tenants: https://use-api.cloudlink.texadasoftware.com/v2/quotes/local-items/[ID] 

The [ID] value at the end of the URL is the ID of the Local Item whose information you’d like to fetch. This field corresponds to the “Local Item ID” column in the Local Items table in iQuote. Include this value to only fetch information for the specified Item. Omit this value to fetch all Local Items.


Input

Header:
tenant [your company’s tenant value]
authorization Bearer [your access_token]


Output

This method outputs a single Local Item object (if an ID was passed) or multiple Local Item objects (if no ID was passed). See “Local Item Data Format” for a breakdown of how Local item objects are structured.

Local Items (POST)

The POST method of the Local Item endpoint allows you to add, update, and delete Local Items. It accepts a Local Item object as input, and outputs a response code based on whether the action was a success or failure.


Endpoint URL

Asia Pacific tenants: https://au-api.cloudlink.texadasoftware.com/v2/quotes/local-items
North America Region tenants: https://use-api.cloudlink.texadasoftware.com/v2/quotes/local-items


actionType

The action taken when calling this method is determined by the “actionType” field. This field has 4 possible values:

actionType

Action

Description

A

Add

Creates a new Local Item. “LocalItemId” must be empty.

U

Update

Updates an existing Local Item.

D

Delete

Deletes an existing Local Item. Does nothing if the specified Item is currently in use.

X

Delete or Deactivate

Deletes an existing Local Item, or sets its status to Not Active if it is currently in use.


Input

This method accepts a Local Item object as input. See “Local Item Data Format” for a breakdown of how Local item objects are structured.


Response Codes

Possible responses for the Local Item POST method are listed below. Upon a successful call, the Local Items table will be updated with provided JSON data in all display areas.

Code

Description

200

Success

410

Invalid Action Type

411

LocalItemId is passed with action Add

412

Record does not exist for Update or Delete action

413

Cannot update BaseModel/Division on item in use

414

Cannot delete item in use

415

Invalid GP% - GP numeric data between 0 and 99.99

416

Invalid Sell Amount.  Set sell Amount proportional to Cost & GP%

420

Missing Required Field - Description / Extra Description / Part Number / Vendor

421

Missing Required Field - Cost Amount

422

Missing Required Field - GP Percent / Sell Amount

430

Invalid value in field - LocalItem Status

431

Invalid value in field - Currency Code

432

Invalid value in field - Division

433

Division or Base Model does not exist


Local Item Data Format

The data format for Local Item objects can be found below. The Local Items (GET) method will return one or more objects of this format when called; the Local Items (POST) method takes an object of this format as input. 

Local Items are JSON objects, and as such, they are case-sensitive.
When working with these objects, ensure that all field names are capitalized exactly as presented in the table below. Similarly, the values for actionType, currencyCode and localItemStatus are also case-sensitive - for example, an actionType of “a” instead of “A” and will not be accepted by the API. 

Field Name

Data Type

Sample Value

Validation

Mandatory on Add

Mandatory on Update / Delete

actionType

String(1)

A

A - Add
U - Update
D - Delete
X - Delete or Deactivate

Y

Y

localItemId

Integer

12345

Must be empty on add

 

Y

baseModel

String(100)

256

Must exist as valid base model

Y

Y

division

String(1)

G

Must be a valid division

Y

Y

description

String(795)

A Part

     

extraDescription

String(400)

A text block

     

partNumber

String(100)

AZ123

     

vendor

String(100)

A Vendor

 

Y

 

segment

String(15)

43

     

serviceManagementControlSystem

String(40)

123/456A

     

costAmount

Currency

132.42

     

grossProfitPercent

Decimal

15.65

     

sellAmount

Currency

157.88

     

currencyCode

String(2)

AU

US - US dollar
AU - Australian dollar
NZ - New Zealand dollar
PG - Papua New Guinean Kina

Y

Y

localItemStatus

String(1)

A

A - Active
N - Not Active

Y

Y