OVERVIEW
A Field Definition defines both how Product specification details are displayed on a screen, such as a website, and how it is stored in the Product Library.
As an example, the following Field Definition describes how battery capacity for a product might be displayed.
{
"Id": 58,
"StringId": "BatteryCapacity",
"InputType": "Float",
"IsRequired": false,
"LanguageInvariantUnit": "mAh",
"DisplayName": "Battery Capacity",
"Unit": "mAh",
"Options": []
}
Using this Field Definition, below is one possible way to display this information on a screen, such as on a “Product Detail” page for a product in an e-commerce site.
In this example, we are using an example value of 1800.
<div class="panel panel-default">
<div class="panel-heading">
<div class="panel-title">Battery</div>
</div>
<table class="table">
<tbody>
<tr>
<td class="name">Battery Capacity</td>
<td class="value">1800 mAh</td>
</tr>
</tbody>
</table>
</div>
The result displayed on the page, with some styling, is shown below
ENDPOINTS
Sandbox: https://productlibraryrc.iqmetrix.net/v1
Production: https://productlibrary.iqmetrix.net/v1
RESOURCES
FieldDefinition
{
"Id": 1,
"StringId": "Product Name",
"InputType": "TestSingleLine",
"IsRequired": true,
"DisplayName": "Product Name",
"Options": [
{}
]
}
Name | Description | |
---|---|---|
Id (Integer ) |
Identifier | |
StringId (String ) |
Consistent identifier across all Environments | |
InputType (String ) |
Type of UI element this FieldDefinition uses, see InputTypes for a list of acceptable values | |
IsRequired (Boolean ) |
A flag to indicate if the input represented by this FieldDefinition can be empty (false) or not (true) | |
LanguageInvariantUnit (String ) |
Unit | |
DisplayName (String ) |
Value to be displayed in the UI | |
Options (Array[object] ) |
List of Options, only used when InputType is SingleSelect or MultiSelect | |
Options.Id (Integer ) |
Identifier | |
Options.Value (String ) |
Value | |
Owner (Integer ) |
Reserved for future use | |
Unit (String ) |
Reserved for future use | |
LastModifiedUtc (DateTime ) |
Reserved for future use | |
IsPrivate (Boolean ) |
Reserved for future use | |
IsArchived (Boolean ) |
Reserved for future use | |
LanguageInvariantName (String ) |
This is a legacy property that should not be used |
ENUMERATIONS
InputTypes
Name |
---|
Currency |
Date |
Float |
Integer |
MultiSelect |
SingleSelect |
TextSingleLine |
TextMultipleLine |
YesNo |
REQUESTS
GET All Field Definitions
Request
GET /FieldDefinitions
Example Request
GET /FieldDefinitions
Authorization: Bearer (Access Token)
Accept: application/json
curl -X GET "https://productlibraryrc.iqmetrix.net/v1/FieldDefinitions" -H "Authorization: Bearer (Access Token)" -H "Accept: application/json"
static IRestResponse GettingAllFieldDefinitions()
{
var client = new RestClient("https://productlibraryrc.iqmetrix.net/v1/FieldDefinitions");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Bearer (Access Token)");
request.AddHeader("Accept", "application/json");
return client.Execute(request);
}
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import java.io.IOException;
public static CloseableHttpResponse GettingAllFieldDefinitions() throws IOException {
CloseableHttpClient httpClient = HttpClients.createDefault();
HttpGet request = new HttpGet("https://productlibraryrc.iqmetrix.net/v1/FieldDefinitions");
request.addHeader("Authorization", "Bearer (Access Token)");
request.addHeader("Accept", "application/json");
return httpClient.execute(request);
}
require 'rest-client'
response = RestClient.get 'https://productlibraryrc.iqmetrix.net/v1/FieldDefinitions', {
:'Authorization' => 'Bearer (Access Token)',
:'Accept' => 'application/json',
}
puts response
Response Parameters
Example Response
HTTP 200 Content-Type: application/json
[
{
"Id": 1,
"StringId": "Product Name",
"InputType": "TestSingleLine",
"IsRequired": true,
"DisplayName": "Product Name",
"Options": [
{}
]
}
]
Array[FieldDefinition]
GET a Field Definition
Request
GET /FieldDefinitions({FieldDefinitionId})
Example Request
GET /FieldDefinitions(1)
Authorization: Bearer (Access Token)
Accept: application/json
curl -X GET "https://productlibraryrc.iqmetrix.net/v1/FieldDefinitions(1)" -H "Authorization: Bearer (Access Token)" -H "Accept: application/json"
static IRestResponse GettingAFieldDefinition()
{
var client = new RestClient("https://productlibraryrc.iqmetrix.net/v1/FieldDefinitions(1)");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Bearer (Access Token)");
request.AddHeader("Accept", "application/json");
return client.Execute(request);
}
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import java.io.IOException;
public static CloseableHttpResponse GettingAFieldDefinition() throws IOException {
CloseableHttpClient httpClient = HttpClients.createDefault();
HttpGet request = new HttpGet("https://productlibraryrc.iqmetrix.net/v1/FieldDefinitions(1)");
request.addHeader("Authorization", "Bearer (Access Token)");
request.addHeader("Accept", "application/json");
return httpClient.execute(request);
}
require 'rest-client'
response = RestClient.get 'https://productlibraryrc.iqmetrix.net/v1/FieldDefinitions(1)', {
:'Authorization' => 'Bearer (Access Token)',
:'Accept' => 'application/json',
}
puts response
URI Parameters
FieldDefinitionId
(Required) - Identifier for the FieldDefinition
Response Parameters
Example Response
HTTP 200 Content-Type: application/json
{
"Id": 1,
"StringId": "Product Name",
"InputType": "TestSingleLine",
"IsRequired": true,
"DisplayName": "Product Name",
"Options": [
{}
]
}
ERRORS
HTTP Status Code | Description | How to Resolve |
---|---|---|
HTTP 404 |
Document not found |
Ensure FieldDefinitionId is correct |