My Products
Help

Using the Attribute Parameter

19-04-2021 16:20 (Updated 21-05-2021)
  • 0 Replies
  • 1 kudos
  • 3112 Views

Currently, the "Attributes" parameter is exposed on the following endpoints. 

Endpoint
Customer
CustomerContract
Inventory
Project
Supplier

 

Setting the attributes for other assets works in the same way as for e.g. customer. 

 

To set Attributes on Customers and Inventory Items you first need to

  1. Create the attributes in the UI.
  2. Assign the attributes to the Customer/Inventory etc. Classes respectively.
  3. Assign the class to the Customer/Inventory Item you want to use them on.
  4. Set the values of the attributes.

1. Creating the attributes:

You can do this in the Attributes screen(ScreenId=CS205000):

2021-04-19 15_58_28-Attributes.png

2. Assigning the attributes to the class:

  • Customer
    • You can either reach the customer classes by
      • Going to screen ScreenId=AR2010PL
      • Clicking on the pen next to the class in the customer card:

2021-04-19 16_05_08-Customers.png2021-04-19 16_04_42-Customer classes.png

Here you then add attributes based on the attributes you have created in the attributes screen.

  • Inventory
    • You can either find the Item classes by:
    • Going to the Item class screen(ScreenId=IN201000)
    • Or clicking in the pen next to the Item class in the Inventory screen:

2021-04-19 16_09_18-Stock items.png2021-04-19 16_09_39-Item classes.png

Same as for customer, you can add attributes here based on the attributes you have created in the Attributes screen.

 

3/4. Setting the attributes and their values

When this has been done, you can under the Attributes tab add the attributes from the classes the Customer/Inventory belongs to and set their values:

2021-04-19 16_11_42-Stock items.png2021-04-19 16_09_39-Item classes.png

 

Using the attribute parameter via the API

 

To use these attributes, below is the syntax to use in your query:

  • Filtering on several attributes.
    {{base}}/inventory?attributes={"AttributeID1":"ValueID1","AttributeID2":"ValueID2"} 
    
  • Filtering on date time
    {{base}}/inventory?attributes={"DATETIME":"2019-04-19"} 
    
  • Filtering on text. It will not match partial strings. only exact string.
    {{base}}/inventory?attributes={"TEXT":"long text to filter upon"} 
    
  • Filtering on True/False
    {{base}}/inventory?attributes={"ACTIVE":"1"} 
    
  • With special case for Multiple selection combo:
    {{base}}/inventory?attributes={"AttributeID":"ValueID1,ValueID2"}​


When encoding your query, the "equal sign" should not be encoded, below is an example for the customer endpoint and accepted forms of encoding it:


Customer Endpoint:

GET {baseUrl}customer?attributes={"DATETEST":"2019-01-01","TEST":"testvalue"}

Encoded: (both encoding examples below are accepted)

  • customer?attributes=%7B"DATETEST":"2019-01-01","TEST":"testvalue"%7D
  • customer?attributes=%7B%22DATETEST%22%3A%222019-01-01%22%2C%22TEST%22%3A%22testvalue%22%7D

Inventory Endpoint

Inventory?attributes={"TEST":"testvalue"}

Encoded: (both encoding examples below are accepted)

  • inventory?attributes=%7B"TEST":"testvalue"%7D
  • inventory?attributes=%7B%22TEST%22%3A%22testvalue%22%7D