Calling Create APIs
Access Create APIs with POST
HTTP requests. Create APIs insert new
resource entries into the database.
REST Create requests use the following types of APIs depending on the Name of the resource that is specified:
manageName
(withOperation=Create
)manageNameHierarchy
(withOperation=Create
)createName
createNameHierarchy
For example, Create requests for orders use createOrder
, and Create
requests for organizations use manageOrganizationHierarchy
. To see
the complete list of resources and APIs, view the REST Javadoc files.
Request format
Use the following HTTP request format to call Create APIs:
POST http://host:port/contextRoot/restapi/Name
Name is the type of resource you want to create.
The following example shows a Create request for an
order:
POST http://host:port/contextRoot/restapi/order
Create-Or-Modify
You can use the "manage" APIs to update a resource if it exists or create the
resource if it does not exist in a single Create-Or-Modify request. To
Create-Or-Modify through REST, submit a
PATCH
to the
Name of the resource collection and pass a document that
describes the resource in the request
body.PATCH http://host:port/contextRoot/restapi/Name
The
Create-Or-Modify feature is only compatible with resource types that use "manage"
APIs. For example, items use manageItem
, and organizations use
manageOrganizationHierarchy
, so you are able to
Create-Or-Modify items and organizations with PATCH
. Refer to the
Javadoc files to see whether a resource type uses "manage" APIs.