C8 REST API Developer Guide
User Manual:
Open the PDF directly: View PDF
.
Page Count: 79
| Download | |
| Open PDF In Browser | View PDF |
Centric 8 REST API
DEVELOPER GUIDE
Version 2, Rev 1
February 2017
i
Centric 8 REST API DEVELOPER GUIDE
Centric Software, Inc.
655 Campbell Technology Parkway,
Suite 200, Campbell
CA 95008
Ph. No.: 1.408.574.7802
Technical Support:
866. 796-6218 8:00 AM-8:00 PM EST
email: support@centricsoftware.com
Documentation Feedback:
documentation@centricsoftware.com
TABLE OF CONTENTS
Copyright © 2017 Centric Software. All rights reserved. Under the copyright laws,
neither the documentation nor the software may be copied, photocopied,
reproduced, translated, or reduced to any electronic medium or machine-readable
form, in whole or in part, without the prior written consent of Centric Software, Inc.,
except in the manner described in the documentation. Centric Software™, Centric
8™, and Centric 8 for Fashion & Soft Goods™ are trademarks or registered
trademarks of Centric Software, Inc. Microsoft, Internet Explorer, and Outlook are
trademarks or registered trademarks of Microsoft Corporation in the United States
and/or other countries. Other product or company names mentioned herein may be
trademarks of their respective owners.
ii
Centric 8 REST API DEVELOPER GUIDE
TABLE OF CONTENTS
1. CENTRIC 8 REST API ............................................................................................................................... 5
What is the Centric 8 REST API? ............................................................................................................ 5
How can I access it? .............................................................................................................................. 5
What is Centric 8 REST URI (endpoint)? ................................................................................................ 5
1.1.1 URI SYNTAX ................................................................................................................................................................. 6
1.1.2 VERSION NAMING CONVENTION ................................................................................................................................ 6
2. C8 REST ENDPOINT EXAMPLE ................................................................................................................ 7
3. HOW TO AUTHENTICATE IN CENTRIC 8 REST API?................................................................................. 8
Login logout example using cURL ......................................................................................................... 8
4. HOW TO PASS PARAMETERS TO THE REST API .................................................................................... 11
5. RESOURCE (ENDPOINT) DETAILS ......................................................................................................... 12
Category1 ............................................................................................................................................ 14
5.1.1 Creating Category1. .................................................................................................................................................. 14
5.1.2 Reading Category1 .................................................................................................................................................... 14
5.1.3 Updating Category1 .................................................................................................................................................. 14
5.1.4 Deleting Category1.................................................................................................................................................... 14
5.1.5 Attribute list of Category1......................................................................................................................................... 15
Category2 ............................................................................................................................................ 16
5.1.6 Creating Category2. .................................................................................................................................................. 16
5.1.7 Reading Category2 .................................................................................................................................................... 16
5.1.8 Updating Category2 .................................................................................................................................................. 16
5.1.9 Deleting Category2.................................................................................................................................................... 16
5.1.10 Attribute list of Category2....................................................................................................................................... 17
Collection............................................................................................................................................. 18
5.1.11 Creating Collection .................................................................................................................................................. 18
5.1.12 Reading Collection .................................................................................................................................................. 18
5.1.13 Updating Collection ................................................................................................................................................. 18
5.1.14 Deleting Collection .................................................................................................................................................. 18
5.1.15 Attribute list of Collection ....................................................................................................................................... 19
ColorSpecification................................................................................................................................ 20
5.1.16 Creating ColorSpecification ..................................................................................................................................... 20
5.1.17 Reading ColorSpecification ..................................................................................................................................... 20
5.1.18 Updating ColorSpecification.................................................................................................................................... 20
5.1.19 Deleting ColorSpecification ..................................................................................................................................... 20
5.1.20 Attribute list of ColorSpecification .......................................................................................................................... 21
ColorMaterial ...................................................................................................................................... 22
5.1.21 Creating ColorMaterial ............................................................................................................................................ 22
5.1.22 Reading ColorMaterial ............................................................................................................................................ 22
5.1.23 Updating ColorMaterial .......................................................................................................................................... 22
5.1.24 Deleting ColorMaterial ............................................................................................................................................ 22
5.1.25 Attribute list of ColorMaterial ................................................................................................................................. 23
Colorway ............................................................................................................................................. 24
5.1.26 Creating Colorway ................................................................................................................................................... 24
5.1.27 Reading Colorway ................................................................................................................................................... 24
5.1.28 Updating Colorway.................................................................................................................................................. 24
5.1.29 Deleting Colorway ................................................................................................................................................... 25
5.1.30 Attribute list of Colorway ........................................................................................................................................ 25
TABLE OF CONTENTS
1
Centric 8 REST API DEVELOPER GUIDE
Issue .................................................................................................................................................... 27
5.1.31 Creating Issue .......................................................................................................................................................... 27
5.1.32 Reading Issue .......................................................................................................................................................... 27
5.1.33 Updating Issue......................................................................................................................................................... 28
5.1.34 Deleting Issue .......................................................................................................................................................... 28
5.1.35 Attribute list of Issue ............................................................................................................................................... 28
Material .............................................................................................................................................. 29
5.1.36 Creating Material .................................................................................................................................................... 29
5.1.37 Reading Material ..................................................................................................................................................... 29
5.1.38 Updating Material ................................................................................................................................................... 29
5.1.39 Deleting Material .................................................................................................................................................... 30
5.1.40 Attribute list of Material ......................................................................................................................................... 30
MaterialType (Read Only) ................................................................................................................... 32
5.1.41 Reading MaterialType ............................................................................................................................................. 32
5.1.42 Creating, Updating, Deleting unsupported ............................................................................................................. 32
5.1.43 Attribute list of MaterialType.................................................................................................................................. 32
ProductSize .......................................................................................................................................... 33
5.1.44 Creating ProductSize ............................................................................................................................................... 33
5.1.45 Reading ProductSize................................................................................................................................................ 33
5.1.46 Updating ProductSize .............................................................................................................................................. 33
5.1.47 Deleting ProductSize ............................................................................................................................................... 34
5.1.48 Attribute list of ProductSize .................................................................................................................................... 34
ProductSource ..................................................................................................................................... 35
5.1.49 Creating ProductSource .......................................................................................................................................... 35
5.1.50 Reading ProductSource ........................................................................................................................................... 35
5.1.51 Updating ProductSource ......................................................................................................................................... 35
5.1.52 Deleting ProductSource .......................................................................................................................................... 36
5.1.53 Attribute list of ProductSource ............................................................................................................................... 36
Season ................................................................................................................................................. 37
5.1.54 Creating Season....................................................................................................................................................... 37
5.1.55 Reading Seasons...................................................................................................................................................... 37
5.1.56 Updating Season ..................................................................................................................................................... 37
5.1.57 Deleting Season ....................................................................................................................................................... 37
5.1.58 Attribute list of Season............................................................................................................................................ 38
Session................................................................................................................................................. 39
5.1.59 Creating a new C8 API Session (login) ..................................................................................................................... 39
5.1.60 GET, PUT unsupported ............................................................................................................................................ 39
5.1.61 Deleting (invalidating) a user session (logout) ........................................................................................................ 39
SizeRange ............................................................................................................................................ 41
5.1.62 Creating SizeRange .................................................................................................................................................. 41
5.1.63 Reading SizeRange .................................................................................................................................................. 41
5.1.64 Updating SizeRange ................................................................................................................................................ 41
5.1.65 Deleting SizeRange .................................................................................................................................................. 42
5.1.66 Attribute list of SizeRange ....................................................................................................................................... 42
SpecDataSheetSubtype (Read Only) ................................................................................................... 43
5.1.67 Reading SpecDataSheetSubtype ............................................................................................................................. 43
5.1.68 POST, PUT, DELETE unsupported ............................................................................................................................ 43
5.1.69 Attribute list of SpecDataSheetSubtype.................................................................................................................. 43
SpecLibraryItem (Read Only) .............................................................................................................. 45
5.1.70 Reading SpecLibraryItem ........................................................................................................................................ 45
5.1.71 POST, PUT, DELETE unsupported ............................................................................................................................ 45
5.1.72 Attribute list of SpecLibraryItem ............................................................................................................................. 45
TABLE OF CONTENTS
2
Centric 8 REST API DEVELOPER GUIDE
Style ..................................................................................................................................................... 46
5.1.73 Creating Style .......................................................................................................................................................... 46
5.1.74 Reading Style ........................................................................................................................................................... 46
5.1.75 Updating Style ......................................................................................................................................................... 46
5.1.76 Deleting Style .......................................................................................................................................................... 47
5.1.77 Attribute list of Style ............................................................................................................................................... 47
StyleType (Read Only) ........................................................................................................................ 49
5.1.78 Reading StyleType ................................................................................................................................................... 49
5.1.79 POST, PUT, DELETE unsupported ............................................................................................................................ 49
5.1.80 Attribute list of StyleType ....................................................................................................................................... 49
Supplier ............................................................................................................................................... 50
5.1.81 Creating Supplier ..................................................................................................................................................... 50
5.1.82 Reading Supplier ..................................................................................................................................................... 50
5.1.83 Updating Supplier ................................................................................................................................................... 50
5.1.84 Deleting Supplier ..................................................................................................................................................... 51
5.1.85 Attribute list of Supplier .......................................................................................................................................... 51
SupplierRequest .................................................................................................................................. 53
5.1.86 Creating SupplierRequest........................................................................................................................................ 53
5.1.87 Reading SupplierRequest ........................................................................................................................................ 53
5.1.88 Updating SupplierRequest ...................................................................................................................................... 53
5.1.89 Deleting SupplierRequest ........................................................................................................................................ 54
5.1.90 Attribute list of SupplierRequest ............................................................................................................................. 54
SupplierRequestTemplate (Read Only) ............................................................................................... 55
5.1.91 Reading SupplierRequestTemplate ......................................................................................................................... 55
5.1.92 POST, PUT, DELETE unsupported ............................................................................................................................ 55
5.1.93 Attribute list of SupplierRequestTemplate ............................................................................................................. 55
User (Read Only) ................................................................................................................................ 56
5.1.94 Reading User ........................................................................................................................................................... 56
5.1.95 Creating, Updating, Deleting unsupported ............................................................................................................. 56
5.1.96 Attribute list of User................................................................................................................................................ 56
6. LIST OF HTTP STATUS CODES AND MESSAGES .................................................................................... 58
7. USING CENTRIC REST API IN JAVA ............................................................................................................. 59
Open source libraries you will need..................................................................................................... 59
8. CALLING CENTRIC 8 REST API ................................................................................................................... 60
Step 1 .................................................................................................................................................. 60
Step 2 .................................................................................................................................................. 61
Step 3 .................................................................................................................................................. 61
Step 4 .................................................................................................................................................. 61
Step 5 .................................................................................................................................................. 61
STEP 6 .................................................................................................................................................. 62
9. JAVA EXAMPLE SOURCE CODE ................................................................................................................... 63
TestJava source code 1/4 .................................................................................................................... 63
CallRest source code 2/4 ..................................................................................................................... 65
HttpResultBean source code 3/4 ......................................................................................................... 71
C8Endpoints source code 4/4 .............................................................................................................. 75
10. KNOWN ISSUES ..................................................................................................................................... 76
TABLE OF CONTENTS
3
Centric 8 REST API DEVELOPER GUIDE
ABOUT THIS GUIDE
Using this Guide
This Guide provides details about the Centric 8 REST API.
Technical Support
Customer Support is available to all registered users of Centric 8.
866-796-6218 8:00 AM-8:00 PM EST
Email: support@centricsoftware.com
ABOUT THIS GUIDE
4
Centric 8 REST API DEVELOPER GUIDE
1. CENTRIC 8 REST API
What is the Centric 8 REST API?
The Centric 8 REST API provides access to Centric 8 data (domain objects) using
HTTP URI resources. You can use the API to integrate Centric 8 with other enterprise,
web and mobile applications. The REST API provides programmatic access to core
C8 resources which will benefit from automated integration with external
applications.
How can I access it?
The Centric 8 REST API is based on the HTTP open standard. You communicate with
this API by making a standard HTTP request and getting the result back in an HTTP
response. The API will allow you to perform CRUD (Create Read Update Delete)
operations by invoking the API using HTTP POST, GET, PUT and DELETE request
methods. The API will restrict the logged-in API user to CRUD operations authorized
by their C8 role..
Here are multiple ways you can interact with the C8 REST API:
Out of the box, use the C8
Swagger interface on a
Development Server
Interactive REST development
tool of your choice such as
Postman (a browser plugin),
JMeter etc.
curl or wget commands in a script
or from the command line
curl and wget are popular
command line HTTP client tools
popular among developers
From your own application
written in any HTTP capable
development language such as
Java, Python, PHP etc.
What is Centric 8 REST URI (endpoint)?
The Centric 8 REST API is organized into related groups of information (such as
"Season", "Style" etc.) known as "resources". Each resource endpoint has one or
CENTRIC 8 REST API
5
Centric 8 REST API DEVELOPER GUIDE
more HTTP Uniform Resource Identifiers (URI) to request specific operations. You
invoke the API’s CRUD and support operations by making HTTP requests to the
appropriate endpoint URI.
1.1.1 URI SYNTAX
The Centric 8 REST URIs have the following syntax:
http[s]://{c8server}/csi-requesthandler/api/{version}/{resource_path}
Where:
§
http[s]: Is the URI scheme and indicates a clear text or encrypted
connection
§
{c8server}: The name of the Centric 8 server hosting the REST service
(this part of the URI might include a port number).
§
csi-requesthandler/api: This should be entered verbatim as it is part of
Centric 8 REST URI.
§
{version}: The version of the Centric 8 REST APIs, such as v1, v2 etc. The
current version is V2.
§
{resource_path}: A {resource_path} identifies a particular resource and
provides qualifying parameters for the specific resource.
§
{} Braces (“curly braces”) are used to identify a mandatory parameter.
§
[] Brackets (“square brackets”) are used to identify optional parameters.
§
<> Angle Brackets will be used to denote a term with an extended
definition.
1.1.2 VERSION NAMING CONVENTION
We follow the widely adopted REST API versioning approach specifying the version
number in the REST URI as illustrated above.
The benefit of this versioning convention is:
The previous version API will still remain accessible and usable
untill it is retired under Centric API deprecation policy
CENTRIC 8 REST API
6
Centric 8 REST API DEVELOPER GUIDE
2. C8 REST ENDPOINT EXAMPLE
Endpoint
GET
http://c8server/csi
-requesthandler/v2
/seasons
Retrieves a
collection of
Season
resources
which match
the optional
search and
control
parameters
http://c8server/csi
requesthandler/v2/s
easons/C2234
Retrieves a
specific C8
Season
resource
details,
identified by
the
resource_id
PUT
POST
DELETE
Creates a
new season
using
details
provided in
the POST
request
body
Updates a
specific C8
season
details,
identified by
the
resource_id
Deletes a
specific C8
Season,
identified
by the
resource_id
This is a simple example. In subsequent sections, you will note a variation that some
resources are created in a hierarchal structure. For example, a Category1 resource
is created using a POST request to the Season endpoint.
C8 REST ENDPOINT EXAMPLE
7
Centric 8 REST API DEVELOPER GUIDE
3. HOW TO AUTHENTICATE IN CENTRIC 8 REST
API?
You must be authenticated as a C8 user to access the REST API using any of the
HTTP requests created using the previously described methods. You authenticate by
using the C8 REST API Session endpoint and store the authentication token returned
by the C8 server such that the correct cookies will be returned in subsequent HTTP
requests. From that point, use that authentication token every time you use the
REST API. Note: the authentication token remains valid for the session duration
configured for your C8 server. Once the token has expired, you need to replace the
authentication process and replace the authentication token.
If you want to access the C8 REST API in the development server through Swagger
interface, then you must login to the Centric 8 Server using the Centric 8 Web UI or
using Swagger to invoke the Session endpoint to create a session before using the
Swagger interface.
The following examples will show you how to use the Centric 8 HTTP REST API
Session endpoint to login and logout:
Endpoint
POST
http://{c8server}/
csirequesthandler/api
/{version}/session
Creates a new C8 session. Authentication tokens are returned
in the HTTP response as cookies and in the response body.
The request body may be the JSON formatted object:
{"username": "",
"password": "" }
Or as an XML formatted object:
{your-username}
{your-password}
Login logout example using cURL
HOW TO AUTHENTICATE IN CENTRIC 8 REST API? 8
DELETE
Logs out by
deleting the
existing session at
the server thus
invalidating the
previous
authentication
tokens.
Centric 8 REST API DEVELOPER GUIDE
cURL is a popular developer tool to send HTTP requests using the command line from
a terminal window. In this example, we illustrate how you can use cURL to invoke
the Centric 8 REST API to create a session. This is mostly useful for developer while
developing a REST client application.
Login:
curl
-c
"C*Token.txt"
-I
-X
POST
--header
'Content-Type:
application/json' --header 'Accept: application/json' -d '{
"username": "{user_name}",
"password": "{password}"
}' 'http://{c8_server}/csi-requesthandler/api/v2/session'
Logout:
curl -b "C8Token.txt" -I -X DELETE "http://{c8_server}/csirequesthandler/api/v2/session"
Replace {c8_server}, {user_name}, {password} with appropriate values
-c saves cookies (including authentication token) in the text file cookies.txt. You
will need this file for subsequent REST API calls.
-I returns only the headers, not the response bodies. Use -I if you only want to
check for success (HTTP 200) and utilize cookies to retain the authentication
tokens.
-X is always necessary
On successful curl POST command, you should get a response like this recorded in
the C8Token.txt file created in your file system
HTTP/1.1 200 OK
Cache-Control: No-cache
Content-Length: 4283
Content-Type: text/javascript;charset=UTF-8
Expires: -1
HOW TO AUTHENTICATE IN CENTRIC 8 REST API? 9
Centric 8 REST API DEVELOPER GUIDE
Server: Microsoft-IIS/8.5
PIRequestId: 11074
PIRequestTime: 1
X-Powered-By: Undertow/1
Set-Cookie:
JSESSIONID=c27Gm4PVP-x3K4axbQD8cMLg.origin2;
path=/csi-requesthandler
Set-Cookie:
SecurityTokenURL=centric://_CS_SecurityToken/392776baac14022851
79761a198c60d5; path=/; domain=.csi.local
Server: WildFly/8
PIRequestDBTime: 0
PIRequestTXTime: 0
PIRequestEXTime: 0
X-Powered-By: ASP.NET
Date: Sat, 30 Jul 2016 00:15:02 GMT
HOW TO AUTHENTICATE IN CENTRIC 8 REST API? 10
Centric 8 REST API DEVELOPER GUIDE
4. HOW TO PASS PARAMETERS TO THE REST API
The industry REST API best practices are very flexible in receiving input parameters
from the client application. It supports many different ways to pass parameters,
using:
§
Query parameter
§
Path parameter separated by slashes
§
Path segment separated by semicolon
§
Header parameter
§
Cookie parameter
§
Form parameter
The Centric 8 REST API utilizes many of these parameter passing techniques. This
REST API documentation will specify how parameters are be passed to the different
endpoints. Swagger will illustrate acceptable usage.
HOW TO PASS PARAMETERS TO THE REST API
11
Centric 8 REST API DEVELOPER GUIDE
5. RESOURCE (ENDPOINT) DETAILS
The C8 REST URI structure is described earlier.
For example: http://myc8server.com/csi-requesthandler/api/v2/
This URI string will prefix all actual request URIs composed from the following
documentation. The documentation uses the./ prefix to call it out as a partial URI.
This prefix is not required (but will be ignored by most web servers).
We assume that developers will understand the Centric 8 user interface and the data
resource operations performed via the UI. The C8 REST API provides a mechanism
for manipulating the same data resources. To understand those potential
manipulations, it is critical that the developer understand the Centric 8 application.
Optional Request resource path parameters in any GET Multiple URI
The following documentation refers to the set of resource parameters as
.
Resource path parameters are also referred to as query parameters. They consist of
name / value pairs separated by an equal (=) sign. Names and values must be URL
encoded (sometimes called percent encoded). The first parameter is separated from
the earlier portion of the resource_path with a question-mark (?) character.
Additional parameter pairs are separated using an ampersand (&) character.
Parameter
Description
skip
Use this parameter to control pagination for a large list of
objects. It controls the starting point of the array by skipping
the specific number of objects from the top of the complete
result set. For example: if there are total 100 objects, then a
skip value of 10 will return a object list starting from 11th
object. Skip=0 will return the result from the very first object.
limit
Use this parameter to control pagination for a large list of
objects. It controls the number of objects returned in the result
array. The default is 10 but may be any positive integer
greater than or equal to 1.
modified_after This parameter’s value is a date in yyyy/dd/mmThh:mm:ss.fffZ
format. It limits the GET result to resources modified on or
after the specified time. The .fff portion is optional.
Any GET response resource field can be used as a search filter
parameter except for id and modified_at. Search filter
parameter values must be correct for the value type of the
RESOURCE (ENDPOINT) DETAILS
12
Centric 8 REST API DEVELOPER GUIDE
identified resource field. The values serve to limit the response
resource collection to resources whose specified field has a
value matching the parameter value.
Extended Search for selected EndPoints
To facilitate retrieval of resources associated with a logical container, a new URI
pattern has been introduced to support searching for containers and then subsetting
the content of the containers using contained resource attribute filters. The initial
implementation of this concept is in support of ImageContainers Style, Material
and Colorway, each of which can reference contained Image objects.
The URI path /styles/images?style.parent_season=C3435&tags=front makes a
request of the Style EndPoint to locate all Styles in the specified Season and then
return Images owned by the selected Styles whose tags attribute contains the
value: front.
HTTP Request and Response Bodies in the C8 REST API
Bodies of HTTP requests and responses may be in JSON or XML format. This is
determined by the request content-type (request format) and accept (response
format) HTTP request headers. C8 object attribute names are represented in snake
case (lower case with underscore characters inserted where the attribute name
transitions between cases).
POST requests must provide required values. Depending on the C8 resource, some
fields may only be set in a POST request. Read/only fields can not be set in either
GET or PUT. Do not include empty valued fields in POST or PUT unless you intend
them to be empty in C8.
The response to POST and PUT is always the resulting GET resource.
It is suggested that you use Swagger to obtain a rough approximation of what the
JSON or XML would look like in requests and responses.
The optional HTTP Link header can be used to request that the GET response resource
include the _links field which is a map from reference field values to actual URLs
required to retrieve the referenced object.
RESOURCE (ENDPOINT) DETAILS
13
Centric 8 REST API DEVELOPER GUIDE
Category1
5.1.1 Creating Category1.
URI
./seasons/{season_id}/hierarchy
Comments
Creates a new Category1 object as a
child of Season.
5.1.2 Reading Category1
URI
./seasons/{season_id}/hierarchy[?[skip=m][[&]l
imit=n][& ]..]
./category1s/{category1_id}
./category1s[?[skip=m][[&]limit=n][[&
]..]
Comments
Retrieves the Category1 objects
owned by Season which match
the included
in the resource_path.
Retrieves the specified Category1
object.
Retrieves the Category1 objects
which match the
included in
the resource_path.
5.1.3 Updating Category1
URI
./category1s/{category1_id}
Comments
Updates the specified Category1
object.
5.1.4 Deleting Category1
RESOURCE (ENDPOINT) DETAILS
14
Centric 8 REST API DEVELOPER GUIDE
URI
Comments
Deletes the specified Category1
object.
./category1s/{category1_id}
5.1.5 Attribute list of Category1
Attribute
id
modified_at
node_name
cnt_colorway
cnt_style
hierarchy
issues
parent_season
code
description
links (_links)
Java Type
String
String
String
Integer
Integer
List
List
String
String
String
Map
RESOURCE (ENDPOINT) DETAILS
C8 Type
CNL
time
string
integer
integer
reflist
reflist
ref
string
string
refmap
Read Only
R/O
R/O
R/W
R/O
R/O
R/O
R/O
R/O
R/W
R/W
R/O
Description
C8 System ID
Last time this object was modified.
Display name for the object.
C8 Ref to URI Lookup map.
15
Centric 8 REST API DEVELOPER GUIDE
Category2
5.1.6 Creating Category2.
URI
./category1s/{category1_id}/hierarchy
Comments
Creates a new Category2 object as a
child of Category1.
5.1.7 Reading Category2
URI
./category1s/{category1_id}/hierarchy[?[ski
p=m][[&]limit=n][[&
]..]
./category2s/{category2_id}
./category2s[?[skip=m][[&]limit=n][[&
]..]
Comments
Retrieves the Category2 objects
owned by Category1 which match
included in the
resource_path.
Retrieves the specified Category2
object.
Retrieves the Category2 objects which
match the included
in the resource_path.
5.1.8 Updating Category2
URI
./category2s/{category2_id}
Comments
Updates the specified Category2
object.
5.1.9 Deleting Category2
RESOURCE (ENDPOINT) DETAILS
16
Centric 8 REST API DEVELOPER GUIDE
URI
Comments
Deletes the specified Category2
object.
./category2s/{category2_id}
5.1.10 Attribute list of Category2
Attribute
id
modified_at
node_name
cnt_colorway
cnt_style
category_1
hierarchy
issues
parent_season
code
description
links (_links)
Java Type
String
String
String
Integer
Integer
String
List
List
String
String
String
Map
RESOURCE (ENDPOINT) DETAILS
C8 Type
CNL
time
string
integer
integer
ref
reflist
reflist
ref
string
string
refmap
Read Only
R/O
R/O
R/W
R/O
R/O
R/O
R/O
R/O
R/O
R/W
R/W
R/O
Description
C8 System ID
Last time this object was modified.
Display name for the object.
C8 Ref to URI Lookup map.
17
Centric 8 REST API DEVELOPER GUIDE
Collection
5.1.11 Creating Collection
URI
./category2s/{category2_id}/hierarchy
Comments
Creates a new Collection object as a child
of Category2.
5.1.12 Reading Collection
URI
Comments
./category2s/{category2_id}/hierarchy[?[skip=m
][[&]limit=n][[& ]..]
./collections/{collection_id}
./collections[?[skip=m][[&]limit=n][[&
]..]
Retrieves the Collection objects owned
by Category2 which match the
included in the
resource_path.
Retrieves the specified Collection
object.
Retrieves the Collection objects which
match the included
in the resource_path.
5.1.13 Updating Collection
URI
./collections/{collection_id}
Comments
Updates the specified Collection
object.
5.1.14 Deleting Collection
RESOURCE (ENDPOINT) DETAILS
18
Centric 8 REST API DEVELOPER GUIDE
URI
Comments
Deletes the specified Collection
object.
./collections/{collection_id}
5.1.15 Attribute list of Collection
Attribute
id
modified_at
node_name
cnt_colorway
cnt_style
category_1
category_2
hierarchy
issues
parent_season
code
description
links (_links)
Java Type
String
String
String
Integer
Integer
String
String
List
List
String
String
String
Map
RESOURCE (ENDPOINT) DETAILS
C8 Type
CNL
time
string
integer
integer
ref
ref
reflist
reflist
ref
string
string
refmap
Read Only
R/O
R/O
R/W
R/O
R/O
R/O
R/O
R/O
R/O
R/O
R/W
R/W
R/O
Description
C8 System ID
Last time this object was modified.
Display name for the object.
C8 Ref to URL Lookup map.
19
Centric 8 REST API DEVELOPER GUIDE
ColorSpecification
5.1.16 Creating ColorSpecification
URI
./color_specifications
Comments
Creates a new ColorSpecification
object.
5.1.17 Reading ColorSpecification
URI
Comments
./color_specifications/{color_specificatio
n_id}
Retrieves the specified ColorSpecification
object.
./color_specifications[?[skip=m][[&]limit=
n][& ]..]
Retrieves the ColorSpecification objects
which match the
included in the resource_path.
5.1.18 Updating ColorSpecification
URI
./color_specifications/{color_specificatio
n_id}
Comments
Updates the specified
ColorSpecification object.
5.1.19 Deleting ColorSpecification
URI
./color_specifications/{color_specificatio
n_id}
RESOURCE (ENDPOINT) DETAILS
Comments
Deletes the specified
ColorSpecification object.
20
Centric 8 REST API DEVELOPER GUIDE
5.1.20 Attribute list of ColorSpecification
Attribute
id
modified_at
node_name
sys_id
active
cmyk
code
color_model
color_type
description
ok_for_material
ok_for_style
pantone
pantone_tc
rgb
rgb_hex
rgb_triple
tags
Java Type
String
String
String
String
Boolean
String
String
String
String
String
Boolean
Boolean
String
String
Integer
String
String
List
links (_links)
Map
RESOURCE (ENDPOINT) DETAILS
C8 Type
CNL
time
string
string
boolean
string
string
string
string
string
boolean
boolean
string
string
integer
string
string
stringvect
or
refmap
Read Only
R/O
R/O
R/W
R/O
R/W
R/W
R/W
R/W
R/W
R/W
R/W
R/W
R/W
R/W
R/W
R/W
R/W
R/W
Description
C8 System ID
Last time this object was modified.
Display name for the object.
R/O
C8 Ref to URL Lookup map.
(Not: CMYK, RGBHex, RGBTriple)
(Not: CMYK, RGB, RGBTriple)
(Not: CMYK, RGB, RGBHex)
21
Centric 8 REST API DEVELOPER GUIDE
ColorMaterial
5.1.21 Creating ColorMaterial
URI
./materials/{material_id}/product_colors
Comments
Creates a new ColorMaterial object as a
child of Material.
5.1.22 Reading ColorMaterial
URI
./materials/{material_id}/product_colors[?
[skip=m][[&]limit=n][&
]..]
./color_materials/{color_material_id}
./color_materials[?[skip=m][[&]limit=n][&
]..]
Comments
Retrieves the ColorMaterial objects owned
by Material which match the
included in the
resource_path.
Retrieves the specified ColorMaterial
object.
Retrieves the ColorMaterial objects which
match the included in
the resource_path.
5.1.23 Updating ColorMaterial
URI
./color_materials/{color_material_id}
Comments
Updates the specified ColorMaterial object.
5.1.24 Deleting ColorMaterial
RESOURCE (ENDPOINT) DETAILS
22
Centric 8 REST API DEVELOPER GUIDE
URI
Comments
./color_materials/{color_material_id}
Deletes the specified ColorMaterial object.
5.1.25 Attribute list of ColorMaterial
Attribute
id
modified_at
node_name
cnt_order
cnt_purchased_order
earliest_target_date
status_time
total_order_volume
total_sample_volume
color_material_sk_us
samples
active
description
status
color_material_samples
color_specification
links (_links)
RESOURCE (ENDPOINT) DETAILS
Java
Type
String
String
String
Integer
Integer
String
String
Double
Double
List
List
Boolean
String
String
Map
String
Map
C8 Type
CNL
time
string
integer
integer
time
time
double
double
reflist
reflist
boolean
string
enum
refmap
ref
refmap
Read
Only
R/O
R/O
R/W
R/O
R/O
R/O
R/O
R/O
R/O
R/O
R/O
R/W
R/W
R/W
R/W
R/W
R/O
Description
C8 System ID
Last time this object was modified.
Display name for the object.
C8 Ref to URL Lookup map.
23
Centric 8 REST API DEVELOPER GUIDE
Colorway
5.1.26 Creating Colorway
URI
./styles/{style_id}/product_colors
Comments
Creates a new Colorway object as a child
of Style.
5.1.27 Reading Colorway
URI
./styles/{style_id}/product_colors[?[skip=
m][[&]limit=n][& ]..]
./colorways/{colorway_id}
./colorways[?[skip=m][[&]limit=n][&
]..]
Comments
Retrieves the Colorway objects owned by
Style which match the
included in the resource_path.
Retrieves the specified Colorway object.
Retrieves the Colorway objects which
match the included in
the resource_path.
5.1.28 Updating Colorway
URI
./colorways/{colorway_id}
RESOURCE (ENDPOINT) DETAILS
Comments
Updates the specified Colorway
object.
24
Centric 8 REST API DEVELOPER GUIDE
5.1.29 Deleting Colorway
URI
Comments
Deletes the specified Colorway object.
./colorways/{colorway_id}
5.1.30 Attribute list of Colorway
Attribute
C8 Type
Read Only
Description
id
modified_at
Java
Type
String
String
CNL
time
R/O
R/O
node_name
String
string
R/W
C8 System ID
Last time this object
was modified.
Display name for the
object.
carry_over
cnt_customer_purchase_order
Boolean
Integer
boolean
integer
R/O
R/O
cnt_order
cnt_purchased_order
customer_earliest_target_date
customer_total_order_volume
earliest_target_date
inline
sales_volume
sys_id
Integer
Integer
String
Double
String
Boolean
Integer
String
integer
integer
time
double
time
boolean
integer
string
R/O
R/O
R/O
R/O
R/O
R/O
R/O
R/O
total_order_volume
total_sample_volume
carried_over_from_colorways
category_1
category_2
collection
colorway_skus
copied_from
images
Double
Double
List
String
String
String
List
String
Map
double
double
reflist
ref
ref
ref
reflist
ref
refmap
R/O
R/O
R/O
R/O
R/O
R/O
R/O
R/O
R/O
parent_season
samples
style
active
code
String
List
String
Boolean
String
ref
reflist
ref
boolean
string
R/O
R/O
R/O
R/W
R/W
RESOURCE (ENDPOINT) DETAILS
Customer Purchase
Order Count
Purchased Order Count
Identifier to correlate
revised entities.
Containing Category1
Containing Category2
Containing Collection
[6.0] Images
associated with this
Colorway
Control code.
25
Centric 8 REST API DEVELOPER GUIDE
description
development_type
intro_date
production_min
color_specification
String
String
String
Integer
String
string
enum
time
integer
ref
R/W
R/W
R/W
R/W
R/W
links (_links)
Map
refmap
R/O
RESOURCE (ENDPOINT) DETAILS
Production Minimum
Referenced by Color
Specification
C8 Ref to URL Lookup
map.
26
Centric 8 REST API DEVELOPER GUIDE
Issue
5.1.31 Creating Issue
URI
Comments
./seasons/{season_id}/issues
Creates a new Issue object as a child of
Season.
./category1s/{category1_id}/issues
Creates a new Issue object as a child of
Category1.
./category2s/{category2_id}/issues
Creates a new Issue object as a child of
Category2.
./collections/{collection_id}/issues
Creates a new Issue object as a child of
Collection.
./styles/{style_id}/issues
Creates a new Issue object as a child of
Style.
./materials/{material_id}/issues
Creates a new Issue object as a child of
Material.
5.1.32 Reading Issue
URI
./seasons/{season_id}/issues[?[skip=m][[&]
limit=n][& ]..]
./category1s/{category1_id}/issues[?[skip=
m][[&]limit=n][& ]..]
./cagetory2s/{category2_id}/issues[?[skip=
m][[&]limit=n][& ]..]
./collections/{collection_id}/issues[?[ski
p=m][[&]limit=n][& ]..]
./styles/{style_id}/issues[?[skip=m][[&]li
mit=n][& ]..]
RESOURCE (ENDPOINT) DETAILS
Comments
Retrieves the Issue objects owned by
Season which match the
included in the
resource_path.
Retrieves the Issue objects owned by
Category1 which match the
included in the
resource_path.
Retrieves the Issue objects owned by
Category2 which match the
included in the
resource_path.
Retrieves the Issue objects owned by
Collection which match the
included in the
resource_path.
Retrieves the Issue objects owned by Style
which match the
included in the resource_path.
27
Centric 8 REST API DEVELOPER GUIDE
./materials/{material_id}/issues[?[skip=m]
[[&]limit=n][& ]..]
./issues/{issue_id}
./issues[?[skip=m][[&]limit=n][&
]..]
Retrieves the Issue objects owned by
Material which match the
included in the
resource_path.
Retrieves the specified Issue object.
Retrieves the Issue objects which match
the included in the
resource_path.
5.1.33 Updating Issue
URI
Comments
Updates the specified Issue object.
./issues/{issue_id}
5.1.34 Deleting Issue
URI
Comments
Deletes the specified Issue object.
./issues/{issue_id}
5.1.35 Attribute list of Issue
Attribute
id
modified_at
node_name
status_update_date
comment
description
due_date
status
issue_product_sizes
owner
links (_links)
Java Type
String
String
String
String
String
String
String
String
List
String
Map
RESOURCE (ENDPOINT) DETAILS
C8 Type
CNL
time
string
time
string
string
time
enum
refvector
ref
refmap
Read Only
R/O
R/O
R/W
R/O
R/W
R/W
R/W
R/W
R/W
R/W
R/O
Description
C8 System ID
Last time this object was modified.
Display name for the object.
C8 Ref to URL Lookup map.
28
Centric 8 REST API DEVELOPER GUIDE
Material
5.1.36 Creating Material
URI
./materials
Comments
Creates a new Material object.
5.1.37 Reading Material
URI
Comments
./materials/{material_id}
Retrieves the specified Material object.
./materials[?[skip=m][[&]limit=n][&
]..]
Retrieves the Material objects which
match the included
in the resource_path.
5.1.38 Updating Material
URI
./materials/{material_id}
RESOURCE (ENDPOINT) DETAILS
Comments
Updates the specified Material object.
29
Centric 8 REST API DEVELOPER GUIDE
5.1.39 Deleting Material
URI
Comments
Deletes the specified Material object.
./materials/{material_id}
5.1.40 Attribute list of Material
Attribute
id
modified_at
node_name
bom_main_material_count
cnt_order
cnt_purchased_order
earliest_target_date
managed
status
status_time
sys_id
Java Type
String
String
String
Integer
Integer
Integer
String
Boolean
String
String
String
C8 Type
CNL
time
string
integer
integer
integer
time
boolean
enum
time
string
Read Only
R/O
R/O
R/W
R/O
R/O
R/O
R/O
R/O
R/O
R/O
R/O
total_order_volume
total_shipment_qty
bom_main_materials
bom_materials
product_sizes
active
code
composition
construction
default_color_size_availabil
ity
description
diameter
dimension
fob_calc
fob_negotiated
finish
has_season_availability
is_size_owner
is_stock_managed
length
main_materials
ok_color_specs
Double
Double
List
List
List
Boolean
String
String
String
Boolean
double
double
refset
refset
refvector
boolean
string
string
string
boolean
R/O
R/O
R/O
R/O
R/O
R/W
R/W
R/O
R/W
R/W
String
String
String
Double
Double
String
Boolean
Boolean
Boolean
String
String
Boolean
string
string
string
double
double
string
boolean
boolean
boolean
string
string
boolean
R/W
R/W
R/W
R/W
R/W
R/W
R/W
R/O
R/W
R/W
R/W
R/W
RESOURCE (ENDPOINT) DETAILS
Description
C8 System ID
Last time object modified.
Display name for the object.
Identifier to correlate revised
entities.
Material Code
30
Centric 8 REST API DEVELOPER GUIDE
ok_for_material_bom
ok_for_style_bom
qty_per_container
sample_cost
sourcing_model
tags
Boolean
Boolean
Double
Double
String
List
texture_emboss_ref
thickness
usage
weight
width
actual_size_range
copied_from
images
default_color
default_size
issues
material_compatibility
material_original_category_1
material_original_season
product_colors
product_type
realized_products
tooling_last
tooling_size_range
tooling_sizes
links (_links)
RESOURCE (ENDPOINT) DETAILS
R/W
R/W
R/W
R/W
R/W
R/W
String
String
String
String
String
String
String
Map
boolean
boolean
double
double
enum
stringvect
or
string
string
string
string
string
ref
ref
refmap
String
String
List
List
String
String
List
String
List
List
String
List
Map
ref
ref
reflist
reflist
ref
ref
reflist
ref
reflist
reflist
ref
reflist
refmap
R/W
R/W
R/O
R/W
R/W
R/W
R/O
R/W
R/O
R/W
R/W
R/W
R/O
R/W
R/W
R/W
R/W
R/W
R/W
R/O
R/O
[6.0] Images associated
with this Material
C8 Ref to URL Lookup map.
31
Centric 8 REST API DEVELOPER GUIDE
MaterialType (Read Only)
5.1.41 Reading MaterialType
URI
Comments
./material_types/{material_type_id}
Retrieves the specified MaterialType
object.
./material_types[?[skip=m][[&]limit=n][&
]..]
Retrieves the MaterialType objects which
match the included in
the resource_path.
5.1.42 Creating, Updating, Deleting unsupported
MaterialType is a read-only endpoint. It does not
support POST, PUT or DELETE methods.
5.1.43 Attribute list of MaterialType
Attribute
id
modified_at
node_name
published
available
has_color
has_size
links (_links)
Java Type
String
String
String
Boolean
Boolean
Boolean
Boolean
Map
RESOURCE (ENDPOINT) DETAILS
C8 Type
CNL
time
string
boolean
boolean
boolean
boolean
refmap
Read Only
R/O
R/O
R/W
R/O
R/W
R/W
R/W
R/O
Description
C8 System ID
Last time this object was modified.
Display name for the object.
C8 Ref to URL Lookup map.
32
Centric 8 REST API DEVELOPER GUIDE
ProductSize
5.1.44 Creating ProductSize
URI
Comments
./materials/{material_id}/owned_product_sizes
Creates a new ProductSize object as a
child owned by Material.
./product_sizes
Creates a new ProductSize object.
5.1.45 Reading ProductSize
URI
Comments
./materials/{material_id}/owned_product_sizes
[?[skip=m][[&]limit=n][&
]..]
./product_sizes/{product_size_id}
./product_sizes[?[skip=m][[&]limit=n][&
]..]
Retrieves the ProductSize objects
owned by Material which match the
included in the
resource_path.
Retrieves the specified ProductSize
object.
Retrieves the ProductSize objects
which match the
included in the resource_path.
5.1.46 Updating ProductSize
URI
./product_sizes/{product_size_id}
RESOURCE (ENDPOINT) DETAILS
Comments
Updates the specified ProductSize
object.
33
Centric 8 REST API DEVELOPER GUIDE
5.1.47 Deleting ProductSize
URI
Comments
Deletes the specified ProductSize
object.
./product_sizes/{product_size_id}
5.1.48 Attribute list of ProductSize
Attribute
id
modified_at
node_name
dimension_type
Java Type
String
String
String
String
C8 Type
CNL
time
string
enum
Read Only
R/O
R/O
R/W
R/W
is_two_dim
Boolean
boolean
R/W
localized_name
size_code
us_label
dimension_1_size
dimension_2_size
links (_links)
Map
Integer
String
String
String
Map
stringmap
integer
string
ref
ref
refmap
R/W
R/W
R/W
R/W
R/W
R/O
RESOURCE (ENDPOINT) DETAILS
Description
C8 System ID
Last time this object was modified.
Display name for the object.
Only in C8 V6.0 rekease. The C8
V5.6.6 requests will assume Size
as the value when executed on a
C8 V6.0 system.
Only in C8 V6.0. If true,
dimension_1_size and
dimension_2_size are required
otherwise, they are not allowed.
Only in C8 V6.0
Only in C8 V6.0
C8 Ref to URL Lookup map.
34
Centric 8 REST API DEVELOPER GUIDE
ProductSource
5.1.49 Creating ProductSource
URI
Comments
./shapes/{shape_id}/product_sources
Create a new ProductSource object as
a child of Shape.
./styles/{style_id}/product_sources
Create a new ProductSource object as
a child of Style.
./materials/{material_id}/product_sources
Create a new ProductSource object as
a child of Material.
5.1.50 Reading ProductSource
URI
./shapes/{shape_id}/product_sources[?[skip
=m][[&]limit=n][&...]]
./styles/{style_id}/product_sources[?[skip
=m][[&]limit=n][&...]]
./materials/{material_id}/product_sources[
?[skip=m][[&]limit=n][&...]]
./product_sources/{product_source_id}
./product_sources[?[skip=m][[&]limit=n][&.
..]]
Comments
Retrieve the ProductSource objects
referenced by Shape which match
filter parameters specified as query
string values.
Retrieve the ProductSource objects
referenced by Style which match filter
parameters specified as query string
values.
Retrieve the ProductSource objects
referenced by Material which match
filter parameters specified as query
string values.
Retrieve the specified ProductSource
object.
Retrieve the ProductSource objects
which match filter parameters
specified as query string values.
5.1.51 Updating ProductSource
RESOURCE (ENDPOINT) DETAILS
35
Centric 8 REST API DEVELOPER GUIDE
URI
Comments
Update the specified ProductSource
object.
./product_sources/{product_source_id}
5.1.52 Deleting ProductSource
URI
Comments
Deletes the specified ProductSource
object.
./product_sources/{product_source_id}
5.1.53 Attribute list of ProductSource
Attribute
C8 Type
Read Only
Description
id
modified_at
Java
Type
String
String
CNL
time
R/O
R/O
node_name
String
string
R/W
C8 System ID
Last time this object
was modified.
Display name for the
object.
availability_product
supplier_code
samples
supplier
supplier_items
links (_links)
String
String
List
String
List
Map
ref
string
reflist
ref
refset
refmap
R/O
R/W
R/W
R/W
R/W
R/O
RESOURCE (ENDPOINT) DETAILS
C8 Ref to URL Lookup
map.
36
Centric 8 REST API DEVELOPER GUIDE
Season
5.1.54 Creating Season
URI
./seasons
Comments
Creates a new Season object.
5.1.55 Reading Seasons
URI
Comments
./seasons/{season_id}
Retrieves the specified Season object.
./seasons[?[skip=m][[&]limit=n][&
]..]
Retrieves the Season objects which match the
included in the resource_path.
5.1.56 Updating Season
URI
./seasons/{season_id}
Comments
Updates the specified Season object.
5.1.57 Deleting Season
RESOURCE (ENDPOINT) DETAILS
37
Centric 8 REST API DEVELOPER GUIDE
URI
Comments
Deletes the specified Season object.
./seasons/{season_id}
5.1.58 Attribute list of Season
Attribute
id
modified_at
node_name
cnt_colorway
cnt_style
hierarchy
Java Type
String
String
String
Integer
Integer
List
C8 Type
CNL
time
string
integer
integer
reflist
Read Only
R/O
R/O
R/W
R/O
R/O
R/O
issues
code
description
status
links (_links)
List
String
String
String
Map
reflist
string
string
enum
refmap
R/O
R/W
R/W
R/W
R/O
RESOURCE (ENDPOINT) DETAILS
Description
C8 System ID
Last time this object was modified.
Display name for the object.
Number of Colorways under the Season.
Number of Styles under the Season.
The list of Category 1s' ids that belong to
the Season.
The code of the Season.
The description of the Season.
The Season's Status.
C8 Ref to URL Lookup map.
38
Centric 8 REST API DEVELOPER GUIDE
Session
5.1.59 Creating a new C8 API Session (login)
URI
./session
Comments
Creates a new C8 REST API Session by logging in by using a valid C8 username and
password passed. This data is passed as a JSON/XML payload in the HTTP Request
object. The data model in JSON format is (see section 3 for the XML example):
{
"username": "string",
"password": "string"
}
On success the API will return a valid session and token in the response object. The
JSON data model of the response is:
{
"session": "string",
"token": "string"
}
This session and token should be saved as cookies by your HTTP development
framework so that all subsequent REST API calls will pass the required cookies to the
C8 server to autnenticate the REST API call.
On failure, the REST API will return error information.
5.1.60 GET, PUT unsupported
5.1.61 Deleting (invalidating) a user session (logout)
RESOURCE (ENDPOINT) DETAILS
39
Centric 8 REST API DEVELOPER GUIDE
URI
./session
Comments
Cancels the current user session as identified by the cookie provided authentication
tokens. This is used for logging out from REST API session. The REST API will respond
with HTTP status 401 to indicate that the user is no longer authorized.
RESOURCE (ENDPOINT) DETAILS
40
Centric 8 REST API DEVELOPER GUIDE
SizeRange
5.1.62 Creating SizeRange
URI
./size_ranges
Comments
Creates a new SizeRange object.
5.1.63 Reading SizeRange
URI
Comments
./size_ranges/{size_range_id}
Retrieves the specified SizeRange object.
./size_ranges[?[skip=m][[&]limit=n][&
]..]
Retrieves the SizeRange objects which
match the included in
the resource_path.
5.1.64 Updating SizeRange
URI
./size_ranges/{size_range_id}
RESOURCE (ENDPOINT) DETAILS
Comments
Updates the specified SizeRange object.
41
Centric 8 REST API DEVELOPER GUIDE
5.1.65 Deleting SizeRange
URI
Comments
./size_ranges/{size_range_id}
Deletes the specified SizeRange object.
5.1.66 Attribute list of SizeRange
Attribute
id
modified_at
node_name
type
description
dimension_1_type
dimension_2_type
is_two_dim
ok_for_material
ok_for_size_chart
ok_for_style
active_sizes
base_size
sizes
links (_links)
Java Type
String
String
String
String
String
String
String
Boolean
Boolean
Boolean
Boolean
List
String
List
Map
RESOURCE (ENDPOINT) DETAILS
C8 Type
CNL
time
string
enum
string
enum
enum
boolean
boolean
boolean
boolean
reflist
ref
refvector
refmap
Read Only
R/O
R/O
R/W
R/O
R/W
R/W
R/W
R/W
R/W
R/W
R/W
R/W
R/W
R/W
R/O
Description
C8 System ID
Last time this object was modified.
Display name for the object.
C8 Ref to URL Lookup map.
42
Centric 8 REST API DEVELOPER GUIDE
SpecDataSheetSubtype (Read Only)
5.1.67 Reading SpecDataSheetSubtype
URI
Comments
./spec_data_sheet_subtypes/{spec_data_sheet
_subtype_id}
Retrieves the specified SpecLibraryItem
object.
./spec_library_items[?[skip=m][[&]limit=n]
[& ]..]
Retrieves the SpecLibraryItem
objects which match the
included in the
resource_path.
5.1.68 POST, PUT, DELETE unsupported
SpecDataSheetSubtype is a read-only endpoint. It does
not support POST, PUT or DELETE methods.
5.1.69 Attribute list of SpecDataSheetSubtype
Attribute
id
modified_at
Java Type
String
String
C8 Type
CNL
time
Read Only
R/O
R/O
node_name
String
string
R/O
applied_on
modified
modified_at
published
setup_applied_on
setup_modified
active
setup_active
setup_validation_rule_group_name
String
Boolean
String
Boolean
String
Boolean
Boolean
Boolean
String
time
boolean
time
boolean
time
boolean
boolean
boolean
string
R/O
R/O
R/O
R/O
R/O
R/O
R/O
R/O
R/O
RESOURCE (ENDPOINT) DETAILS
Description
C8 System ID
Last time this object was
modified.
Display name for the
object.
43
Centric 8 REST API DEVELOPER GUIDE
setup_workflow_name
validation_rule_group_name
workflow_name
links (_links)
RESOURCE (ENDPOINT) DETAILS
String
String
String
Map
string
string
string
refmap
R/W
R/W
R/W
R/O
C8 Ref to URL Lookup
map.
44
Centric 8 REST API DEVELOPER GUIDE
SpecLibraryItem (Read Only)
5.1.70 Reading SpecLibraryItem
URI
Comments
./spec_library_items/{spec_library_item_id}
Retrieves the specified SpecLibraryItem
object.
./spec_library_items[?[skip=m][[&]limit=n]
[& ]..]
Retrieves the SpecLibraryItem
objects which match the
included in the
resource_path.
5.1.71 POST, PUT, DELETE unsupported
SpecLibraryItem is a read-only endpoint. It does not
support POST, PUT or DELETE methods.
5.1.72 Attribute list of SpecLibraryItem
Attribute
id
modified_at
node_name
sys_id
active
code
description
tags
library_item_sds_subtype
links (_links)
RESOURCE (ENDPOINT) DETAILS
Java Type
String
String
String
String
Boolean
String
String
List
String
Map
C8 Type
CNL
time
string
string
boolean
string
string
stringvector
ref
refmap
Read Only
R/O
R/O
R/W
R/O
R/W
R/W
R/W
R/W
R/W
R/O
Description
C8 System ID
Last time this object was modified.
Display name for the object.
System ID
Active Item
C8 Ref to URL Lookup map.
45
Centric 8 REST API DEVELOPER GUIDE
Style
5.1.73 Creating Style
URI
./collections/{collection_id}/hierarchy
Comments
Creates a new Style object as a child of the
specified Collection.
5.1.74 Reading Style
URI
Comments
./collections/{collection_id}/hierarchy[?[
skip=m][[&]limit=n][&
]..]
./styles/{style_id}
./styles[?[skip=m][[&]limit=n][&
]..]
Retrieves the Style objects owned by
Collection which match the
included in the
resource_path.
Retrieves the specified Style object.
Retrieves the Style objects which match the
included in the
resource_path.
5.1.75 Updating Style
URI
./styles/{style_id}
RESOURCE (ENDPOINT) DETAILS
Comments
Updates the specified Style object.
46
Centric 8 REST API DEVELOPER GUIDE
5.1.76 Deleting Style
URI
Comments
Deletes the specified Style object.
./styles/{style_id}
5.1.77 Attribute list of Style
Attribute
id
modified_at
Java Type
String
String
C8 Type
CNL
time
Read Only
R/O
R/O
node_name
bom_main_material_count
carry_over
cnt_colorway
cnt_customer_purchase_order
cnt_order
cnt_purchased_order
earliest_target_date
inline
is_size_owner
original_season
total_order_volume
total_shipment_qty
bom_main_materials
bom_materials
carried_over_from_styles
category_1
category_2
collection
issues
parent_season
product_colors
product_sizes
production_colorways
realized_products
sample_colorways
active
code
description
development_type
fob_calc
fob_negotiated
String
Integer
Boolean
Integer
Integer
Integer
Integer
String
Boolean
Boolean
String
Double
Double
List
List
List
String
String
String
List
String
List
List
List
List
List
Boolean
String
String
String
Double
Double
string
integer
boolean
integer
integer
integer
integer
time
boolean
boolean
string
double
double
refset
refset
reflist
ref
ref
ref
reflist
ref
reflist
refvector
refset
reflist
refset
boolean
string
string
enum
double
double
R/W
R/O
R/O
R/O
R/O
R/O
R/O
R/O
R/O
R/O
R/O
R/O
R/O
R/O
R/O
R/O
R/O
R/O
R/O
R/O
R/O
R/O
R/O
R/O
R/O
R/O
R/W
R/W
R/W
R/W
R/W
R/W
RESOURCE (ENDPOINT) DETAILS
Description
C8 System ID
Last time this object was
modified.
Display name for the object.
47
Centric 8 REST API DEVELOPER GUIDE
main_materials
sample_cost
actual_size_range
assigned_agents
copied_from
images
String
Double
String
List
String
Map
string
double
ref
reflist
ref
refmap
R/W
R/W
R/W
R/W
R/O
R/O
default_color
default_size
marketing_main_material
product_type
size_set_sample_sizes
links (_links)
String
String
String
String
List
Map
ref
ref
ref
ref
reflist
refmap
R/W
R/W
R/W
R/W
R/W
R/O
RESOURCE (ENDPOINT) DETAILS
[6.0] Images associated
with this Style
C8 Ref to URL Lookup
map.
48
Centric 8 REST API DEVELOPER GUIDE
StyleType (Read Only)
5.1.78 Reading StyleType
URI
Comments
./style_types/{style_type_id}
Retrieves the specified StyleType object.
./style_types[?[skip=m][[&]limit=n][&
]..]
Retrieves the StyleType objects which
match the included in
the resource_path.
5.1.79 POST, PUT, DELETE unsupported
StyleType is a read-only endpoint. It does not support
POST, PUT or DELETE methods.
5.1.80 Attribute list of StyleType
Attribute
id
modified_at
node_name
published
Java Type
String
String
String
Boolean
C8 Type
CNL
time
string
boolean
Read Only
R/O
R/O
R/O
R/O
available
has_color
has_size
links (_links)
Boolean
Boolean
Boolean
Map
boolean
boolean
boolean
refmap
R/O
R/O
R/O
R/O
RESOURCE (ENDPOINT) DETAILS
Description
C8 System ID
Last time this object was modified.
Display name for the object.
Indicates whether the StyleType has been
published for production use.
Indicates whether the StyleType is active.
Indicates whether the StyleType allows colors.
Indicates whether the StyleType allows size.
C8 Ref to URL Lookup map.
49
Centric 8 REST API DEVELOPER GUIDE
Supplier
5.1.81 Creating Supplier
URI
./suppliers
Comments
Creates a new Supplier object.
5.1.82 Reading Supplier
URI
Comments
./suppliers/{supplier_id}
Retrieves the specified Supplier object.
./suppliers[?[skip=m][[&]limit=n][&
]..]
Retrieves the Supplier objects which match
the included in the
resource_path.
5.1.83 Updating Supplier
URI
./suppliers/{supplier_id}
RESOURCE (ENDPOINT) DETAILS
Comments
Updates the specified Supplier object.
50
Centric 8 REST API DEVELOPER GUIDE
5.1.84 Deleting Supplier
URI
Comments
Deletes the specified Supplier object.
./suppliers/{supplier_id}
5.1.85 Attribute list of Supplier
Attribute
id
modified_at
node_name
actual_lead_time
compliant
offline
on_time
po_count
ship_date_variance
agent
address
address_1
address_2
city
classification
commission_pct
company
currency
email
fax
is_agent
is_supplier
is_warehouse
job_title
language
lead_time
localized_address
lock
moq_initial
moq_reorder
mobile
payment_term
phone_number
photocopy_number
postal_code
Java Type
String
String
String
Integer
Boolean
Boolean
Double
Integer
Integer
String
String
String
String
String
String
Double
String
String
String
String
Boolean
Boolean
Boolean
String
String
String
String
String
Integer
Integer
String
String
String
String
String
RESOURCE (ENDPOINT) DETAILS
C8 Type
CNL
time
string
integer
boolean
boolean
double
integer
integer
ref
string
string
string
string
enum
double
string
string
string
string
boolean
boolean
boolean
string
string
string
string
string
integer
integer
string
string
string
string
string
Read Only
R/O
R/O
R/W
R/O
R/O
R/O
R/O
R/O
R/O
R/O
R/W
R/W
R/W
R/W
R/W
R/W
R/W
R/W
R/W
R/W
R/W
R/W
R/W
R/W
R/W
R/W
R/W
R/W
R/W
R/W
R/W
R/W
R/W
R/W
R/W
Description
C8 System ID
Last time this object was modified.
Display name for the object.
51
Centric 8 REST API DEVELOPER GUIDE
purpose
state
supplier_number
supplier_payer_numb
er
telex
trade_term
type_code
type_desc
website
suppliers
links (_links)
String
String
String
String
string
enum
string
string
R/W
R/W
R/W
R/W
String
String
String
String
String
List
Map
string
enum
string
string
string
reflist
refmap
R/W
R/W
R/W
R/W
R/W
R/W
R/O
RESOURCE (ENDPOINT) DETAILS
C8 Ref to URL Lookup map.
52
Centric 8 REST API DEVELOPER GUIDE
SupplierRequest
5.1.86 Creating SupplierRequest
URI
./supplier_requests
Comments
Create a new SupplierRequest object.
5.1.87 Reading SupplierRequest
URI
Comments
./supplier_requests/{supplier_request_id}
Retrieve the specified
SupplierRequest object.
./supplier_requests[?[skip=m][[&]limit=n][
&...]]
Retrieve the SupplierRequest objects
which match filter parameters
specified as query string values.
5.1.88 Updating SupplierRequest
URI
./supplier_requests/{supplier_request_id}
RESOURCE (ENDPOINT) DETAILS
Comments
./supplier_requests/{supplier_request_id}
53
Centric 8 REST API DEVELOPER GUIDE
5.1.89 Deleting SupplierRequest
URI
Comments
./supplier_requests/{supplier_request_id}
Delete the specified SupplierRequest
object.
5.1.90 Attribute list of SupplierRequest
Attribute
id
modified_at
node_name
modified_at
pdf
state
state_change_time
modified_by
state_change_user
due_date
request_type
submit_quotes_to_wf
initiated_by_agent
requester
sr_sources
sr_suppliers
sr_template
links (_links)
_url_base_template
Java Type
String
String
String
String
String
String
String
String
String
String
String
Boolean
String
String
List
List
String
Map
String
RESOURCE (ENDPOINT) DETAILS
C8 Type
CNL
time
string
time
url
enum
time
ref
ref
time
enum
boolean
ref
ref
reflist
reflist
ref
refmap
string
Read Only
R/O
R/O
R/W
R/O
R/O
R/O
R/O
R/O
R/O
R/W
R/W
R/W
R/W
R/W
R/W
R/W
R/W
R/O
R/O
Description
C8 System ID
Last time this object was modified.
Display name for the object.
C8 Ref to URL Lookup map.
File (image, pdf, document) retrieval URL
template.
54
Centric 8 REST API DEVELOPER GUIDE
SupplierRequestTemplate (Read Only)
5.1.91 Reading SupplierRequestTemplate
URI
Comments
./supplier_request_templates/{supplier_requ
est_template_id}
Retrieve the specified
SupplierRequestTemplate object.
./supplier_request_templates[?[skip=m][[&]l
imit=n][&...]]
Retrieve the
SupplierRequestTemplate objects
which match filter parameters
specified as query string values.
5.1.92 POST, PUT, DELETE unsupported
SupplierRequestTemplate is a read-only endpoint. It does
not support POST, PUT or DELETE methods.
5.1.93 Attribute list of SupplierRequestTemplate
Attribute
id
modified_at
Java Type
String
String
C8 Type
CNL
time
Read Only
R/O
R/O
node_name
String
string
R/O
modified_at
modified_by
request_type
sample_type
submit_quotes_to_wf
srt_quotes
srt_suppliers
links (_links)
String
String
String
String
Boolean
List
List
Map
time
ref
enum
enum
boolean
reflist
reflist
refmap
R/O
R/O
R/W
R/W
R/W
R/W
R/W
R/O
RESOURCE (ENDPOINT) DETAILS
Description
C8 System ID
Last time this object
was modified.
Display name for the
object.
C8 Ref to URL Lookup
map.
55
Centric 8 REST API DEVELOPER GUIDE
User (Read Only)
5.1.94 Reading User
URI
Comments
./users/{user_id}
Retrieves the specified User object.
./users[?[skip=m][[&]limit=n][&
]..]
Retrieves the User objects which
match the
included in the resource_path.
5.1.95 Creating, Updating, Deleting unsupported
User is a read only endpoint. It does not support POST,
PUT or DELETE methods.
5.1.96 Attribute list of User
Attribute
id
modified_at
node_name
foreign_id
active
business_phone
city
country
email
fax
first_name
home_phone
last_name
locale
middle_name
Java Type
String
String
String
String
Boolean
String
String
String
String
String
String
String
String
String
String
RESOURCE (ENDPOINT) DETAILS
C8 Type
CNL
time
string
string
boolean
string
string
string
string
string
string
string
string
string
string
Read Only*
R/O
R/O
R/O
R/O
R/O
R/O
R/O
R/O
R/O
R/O
R/O
R/O
R/O
R/O
R/O
Description
C8 System ID
Last time this object was modified.
Display name for the object.
Is User Active
56
Centric 8 REST API DEVELOPER GUIDE
mobile_phone
postal_code
province
street_address
user_id
links (_links)
String
String
String
String
String
Map
RESOURCE (ENDPOINT) DETAILS
string
string
string
string
string
refmap
R/O
R/O
R/O
R/O
R/O
R/O
C8 Ref to URL Lookup map.
57
Centric 8 REST API DEVELOPER GUIDE
6. LIST OF HTTP STATUS CODES AND MESSAGES
The HTTP standard provides a list of status codes to convey the success or error
status of each request. The C8 REST API utilizes the subset of these codes relevant
to C8 operation, while preserving full error details in the JSON or XML error response
body. The HTTP status codes utilized by the C8 REST API are as follows:
HTTP Status code
200
201
204
400
401
403
404
405
406
415
500
503
Caused by
Successful REST API call
Successful create
Success with no additional content
Bad request
Not authorized
javax.ws.rs.ForbiddenException
Not found
javax.ws.rs.NotAllowedException
javax.ws.rs.NotAcceptableException
javax.ws.rs.NotSupportedException
Internal server error
javax.ws.rs.ServiceUnavailableException
LIST OF HTTP STATUS CODES AND MESSAGES
58
Centric 8 REST API DEVELOPER GUIDE
7. Using Centric REST API in Java
We have built a small REST client application to illustrate the important API
concepts. The diagram below shows how a REST Client application interacts with a
REST Service provider using the HTTP protocol.
XML/JSON
payload
http://c8serv/csi-requesthandler/api/v2/…
REST service request
REST Client
XML/JSON
payload
REST
Service
Provider
REST service response
HTTP code 200
The REST Client invokes the REST endpoint (HTTP URI) using appropriate HTTP
methods POST, GET, PUT, DELETE and sends the attributes/parameters by loading
them in XML or JSON payload or in HTTP header. The REST service provider
performs the necessary business transaction for the request and returns the result
XML/JSON payload with an appropriate HTTP error code such as 200 (successful
HTTP request).
An HTTP client interacts with the REST service provider using HTTP, so the client
can be written by using any HTTP capable Internet programming language. In this
example, we will use Java to write the client application, however you are free to
use any suitable language and framework of your choice such as C++, Python etc.
Open source libraries you will need
We have used two open source libraries from Apache Foundation and Google to
write this example. It is possible to write an REST client using only out of the box
JDK libraries, however using these two open source libraries greatly simplify the
communication and cookie management programming so the example code
becomes more readable. To try out the example code, you should first download
the following open source libraries from Apache and Google Maven repositories and
add them to your java IDE library path:
Using Centric REST API in Java
59
Centric 8 REST API DEVELOPER GUIDE
HTTP client and core library from Apache foundation
https://mvnrepository.com/artifact/org.apache.httpcomponents
Gson from Google
https://mvnrepository.com/artifact/com.google.code.gson/gson
The following screenshot shows how I have set the required open source jar files in
Eclipse IDE library path
In the following section I will explain the important communication code snippets,
without going into line by line explanation of the example code. Please look into the
complete source code to see how these code snippets have been used in the actual
example.
8. Calling Centric 8 REST API
Use this pattern to call any Centric REST endpoints. In this example, we are
invoking the Session endpoint to log on to the Centric 8 server. Without a valid
logon, all REST API call will return unauthorized access error. Let us assume your
Centric 8 server URI is http://c8server
Step 1
Instantiate a HttpPost/HttpGet/HttpPut/HttpDelete object as
appropriate for the REST endpoint.
Calling Centric 8 REST API
60
Centric 8 REST API DEVELOPER GUIDE
httpPost = new HttpPost(“http://c8server/csi-requesthandler/api/v2/session”);
The HttpPost object will call the Session endpoint using Http POST
method, HttpGet will call the endpoint with HTTP GET method and so on.
Step 2
Create the JSON payload by initializing a StringEntity with identity
information
String json = "{\"username\": \"" + username + "\", \"password\": \""
+ password + "\" }";
stringEntity = new StringEntity(json);
stringEntity.setContentType("application/json");
Step 3
Load the StringEntity to the HttpPost you have instantiated in step 1
httpPost.setEntity(stringEntity);
Step 4
Execute the POST call to Session endpoint and retrieve the HTTP
response from the Centric 8 server. This response will contain the
session token in the JSON payload as well as the HTTP error code
CloseableHttpResponse httpResponse;
httpResponse = closableHttpClient.execute(httpPost);
Step 5
Parse the HTTPResponse
// get the error code
httpResponse.getStatusLine().getStatusCode();
Calling Centric 8 REST API
61
Centric 8 REST API DEVELOPER GUIDE
// get the error message
httpResponse.getStatusLine().getReasonPhrase();
// get the http response headers
httpResponse.getAllHeaders();
// get the entity which contains the JSON or XML return payload
httpResponse.getEntity());
STEP 6
Do not forget to close the HTTP response.
httpResponse.close();
The actual working example code is provided in the following pages.
Calling Centric 8 REST API
62
Centric 8 REST API DEVELOPER GUIDE
9. Java Example Source Code
TestJava source code 1/4
/*
* An example java program to illustrate how to use C8 REST API.
* This is the entry point of the program. It uses a sample C8 REST
API access framework CallREST.java
*
* Author: Soumya Mitra
* Date:
September 28, 2016
* Version: 1.0
*
* DISCLAIMER: This code is provided as is as an example and
unsupported by
*
Centric 8 technical support.
*
* License:
Creative Commons Attribution-ShareAlike
*/
public class TestREST {
HttpResultBean resultBean;
TestREST() {
// Creating an instance or worker class
CallREST callrest = new CallREST();
resultBean = new HttpResultBean();
try {
// ==========
Testing Session Login ================
resultBean = callrest.login("",
"" );
System.out.println("Headers received from server
for Session POST =====");
resultBean.printHeaders();
System.out.println("JSON: " +
resultBean.toPrettyFormat() + "\n----------------------\n");
Java Example Source Code
63
Centric 8 REST API DEVELOPER GUIDE
// ==========
Testing Season ================
resultBean = callrest.seasons(0, 10);
System.out.println("Headers received from server
for Seasons GET =====");
resultBean.printHeaders();
System.out.println("JSON: " +
resultBean.toPrettyFormatArray() + "\n----------------------\n");
// ==========
Testing MaterialType ================
resultBean = callrest.materialTypes(0, 10);
System.out.println("Headers received from server
for MaterialTypes GET =====");
resultBean.printHeaders();
System.out.println("JSON: " +
resultBean.toPrettyFormatArray() + "\n----------------------\n");
// ==========
Testing Session Logout ================
resultBean = callrest.logout();
System.out.println("Headers received from server
for Session DELETE =====");
resultBean.printHeaders();
// =========== close the client session ===========
callrest.closableHttpClient.close();
} catch(Exception e) {
// Catch any exception while
// closing the connection
e.printStackTrace();
}
}
public static void main(String argv[]){
new TestREST();
}
}
Java Example Source Code
64
Centric 8 REST API DEVELOPER GUIDE
CallRest source code 2/4
/*
* An example java program to illustrate how to use C8 REST API
* Uses opensource HTTP client and core library from Apache foundation
https://mvnrepository.com/artifact/org.apache.httpcomponents
* and Gson from Google
https://mvnrepository.com/artifact/com.google.code.gson/gson
*
*
* Author: Soumya Mitra
* Date:
September 28, 2016
* Version: 1.0
*
* DISCLAIMER: This code is provided as is as an example and
unsupported by
*
Centric 8 technical support.
*
* License:
Creative Commons Attribution-ShareAlike
*/
import
import
import
import
import
import
import
import
import
import
import
org.apache.http.impl.client.*;
org.apache.http.impl.cookie.BasicClientCookie;
org.apache.http.protocol.BasicHttpContext;
org.apache.http.HttpHeaders;
org.apache.http.client.methods.*;
org.apache.http.client.protocol.HttpClientContext;
org.apache.http.entity.*;
java.io.IOException;
java.net.CookieHandler;
java.net.CookieManager;
java.util.StringTokenizer;
public class CallREST {
CloseableHttpClient closableHttpClient;
CloseableHttpResponse httpResponse;
HttpGet httpGet;
HttpPost httpPost;
HttpDelete httpDelete;
org.apache.http.Header[] httpResponseHeader;
StringEntity stringEntity;
Java Example Source Code
65
Centric 8 REST API DEVELOPER GUIDE
HttpResultBean hrb = new HttpResultBean();
String[] httpHeaderValues;
StringTokenizer st;
BasicHttpContext basicContext;
BasicCookieStore basicCookieStore;
BasicClientCookie basicCookie;
public CallREST() {
CookieHandler.setDefault(new CookieManager());
basicContext = new BasicHttpContext();
basicCookieStore = new BasicCookieStore();
basicContext.setAttribute(HttpClientContext.COOKIE_STORE,
basicCookieStore);
closableHttpClient =
HttpClientBuilder.create().setDefaultCookieStore(basicCookieStore).bui
ld();
}
/*
*
*
*
*/
===============================================
REST calls to Session endpoint
==================== START ====================
// Login
// Returns HTTP error code and message in HttpResultBean
public HttpResultBean login(String username, String password)
throws Exception{
try {
// Initializing the HttpPost for Session endpoints
httpPost = new HttpPost(C8Endpoints.SESSION);
// Initializing a StringEntity with identity JSON object
String json = "{\"username\": \"" + username + "\",
\"password\": \"" + password + "\" }";
stringEntity = new StringEntity(json);
stringEntity.setContentType("application/json");
// Loading the StringEntiry to the HttpPost request
httpPost.setEntity(stringEntity);
Java Example Source Code
66
Centric 8 REST API DEVELOPER GUIDE
// Executing the POST to Session endpoint for login and
setting session cookie
httpResponse = closableHttpClient.execute(httpPost);
// Loading HttpResultBean with Http Error code and messages
to communicate to caller
hrb.setResultBean(httpResponse);
} catch(Exception e){
e.printStackTrace();
}
finally{
// Closing open httpResponse
if(httpResponse != null)
httpResponse.close();
}
return hrb;
}
// Logout
// Returns HTTP error code and message in HttpResultBean
public HttpResultBean logout() throws IOException{
try{
// Initializing the HttpDelete for Session endpoints
httpDelete = new HttpDelete(C8Endpoints.SESSION);
// Executing the DELETE request to the Session
endpoint to logout
httpResponse = closableHttpClient.execute(httpDelete);
// Loading HttpResultBean with Http Error code and
messages to communicate to caller
hrb.setResultBean(httpResponse);
} catch(Exception e){
e.printStackTrace();
}
finally{
// Closing open httpResponse
if(httpResponse != null)
httpResponse.close();
this.invalidateCookie();
}
Java Example Source Code
67
Centric 8 REST API DEVELOPER GUIDE
// returning the HttpResultBean to the caller
return hrb;
}
/*
*
*
*
*/
===============================================
REST calls to Session endpoint
===================== END =====================
/*
*
*
*
*/
===============================================
REST calls to Season endpoint
==================== START ====================
// Get all seasons from Centric 8 Server
// Returns season array, HTTP error code and message in
HttpResultBean
public HttpResultBean seasons(int skip, int limit ) throws
Exception{
try {
// Initializing the HttpPost for Season endpoints
String uriString = C8Endpoints.SEASON +
"/?skip="+skip+"&limit=" + limit;
httpGet = new HttpGet(uriString);
// ensure the response will be in JSON format
httpGet.addHeader(HttpHeaders.ACCEPT,
"application/json");
// Executing the POST to Season endpoint
httpResponse = closableHttpClient.execute(httpGet);
// Loading HttpResultBean with Http Error code and
messages to communicate to caller
hrb.setResultBean(httpResponse);
} catch(Exception e){
e.printStackTrace();
}
finally{
// Closing open httpResponse
Java Example Source Code
68
Centric 8 REST API DEVELOPER GUIDE
if(httpResponse != null)
httpResponse.close();
}
return hrb;
}
/*
*
*
*
*/
===============================================
REST calls to MaterialTypes endpoint
==================== START ====================
// Get all MaterialTypes from Centric 8 Server
// Returns MaterialType array, http error code and message
in HttpResultBean
public HttpResultBean materialTypes(int skip, int limit )
throws Exception{
try {
// Initializing the HttpGet for MaterialTypes
endpoint
String uriString = C8Endpoints.MATERIAL_TYPE +
"/?skip="+skip+"&limit=" + limit;
httpGet = new HttpGet(uriString);
// ensure the response will be in JSON format
httpGet.addHeader(HttpHeaders.ACCEPT,
"application/json");
// Executing the GET to MaterialTypes endpoint
httpResponse =
closableHttpClient.execute(httpGet);
// Loading HttpResultBean with Http Error code
and messages to communicate to caller
hrb.setResultBean(httpResponse);
} catch(Exception e){
e.printStackTrace();
}
finally{
// Closing open httpResponse
if(httpResponse != null)
httpResponse.close();
}
return hrb;
Java Example Source Code
69
Centric 8 REST API DEVELOPER GUIDE
}
public void setCookie(String id, String value) {
System.out.println("Seeting Cookie: " + id + "
basicCookieStore.addCookie(new
BasicClientCookie(id,value));
}
" + value);
public void invalidateCookie() {
basicCookieStore.clear();
}
}
Java Example Source Code
70
Centric 8 REST API DEVELOPER GUIDE
HttpResultBean source code 3/4
/*
* An example java program to illustrate how to use C8 REST API
* Uses opensource HTTP client and core library from Apache foundation
https://mvnrepository.com/artifact/org.apache.httpcomponents
* and Gson from Google
https://mvnrepository.com/artifact/com.google.code.gson/gson
*
* Author: Soumya Mitra
* Date:
September 28, 2016
* Version: 1.0
*
* DISCLAIMER: This code is provided as is as an example and not
supported by
*
Centric 8 technical support.
*
* License:
Creative Commons Attribution-ShareAlike
*/
import
import
import
import
org.apache.http.Header;
org.apache.http.HttpEntity;
org.apache.http.client.methods.CloseableHttpResponse;
org.apache.http.util.EntityUtils;
import
import
import
import
import
com.google.gson.Gson;
com.google.gson.GsonBuilder;
com.google.gson.JsonArray;
com.google.gson.JsonObject;
com.google.gson.JsonParser;
public class HttpResultBean {
private int httpCode = 0;
private String httpErrorMessage = "";
private String[] headerValues = null;
private Header[] headers = null;
private HttpEntity entity = null;
private String stringBody = null;
private String resultJSON = null;
// Will contain REST API Http
Response JSON Payload
private void setJSONString(String json) {
Java Example Source Code
71
Centric 8 REST API DEVELOPER GUIDE
this.resultJSON = json;
}
public void setHttpCode( int i) {
this.httpCode = i;
}
public void setHttpErrorMessage(String s) {
this.httpErrorMessage = s;
}
public void setHeaders(Header[] hdrs){
if(hdrs != null) {
headers = hdrs;
headerValues = new String[hdrs.length];
for ( int ctr=0; ctr
Source Exif Data:
File Type : PDF
File Type Extension : pdf
MIME Type : application/pdf
PDF Version : 1.6
Linearized : Yes
Author : Soumya Mitra
Create Date : 2017:02:17 16:29:33Z
Modify Date : 2018:07:19 17:01:10+02:00
Subject :
Has XFA : No
XMP Toolkit : Adobe XMP Core 5.6-c015 84.159810, 2016/09/10-02:41:30
Format : application/pdf
Creator : Soumya Mitra
Description :
Title : C8 REST API Developer Guide_V2 Rev1
Creator Tool : Word
Metadata Date : 2018:07:19 17:01:10+02:00
Keywords :
Producer : Mac OS X 10.12.3 Quartz PDFContext
Document ID : uuid:d4bb5bf6-926e-7e44-8505-208bbe2ac317
Instance ID : uuid:e29e2707-f050-4fa3-b36a-4d61f9154c38
Page Count : 79
EXIF Metadata provided by EXIF.tools