Send Requests
Use the following guidelines when sending requests using the Commerce REST API.
URL Structure
https://<subdomain>.<domain>.com:<port>/<resource-path>
-
<subdomain.domain>.com:<port>
- Host and port where Commerce is running. -
<resource-path>
- Relative path that defines the resource.
Supported Methods
You can perform basic CRUD operations (create, read, update, and delete) on using standard HTTP method requests, as summarized in the following table.
HTTP Method | Description |
GET |
Retrieve information about the specified resource. |
POST |
Request that the server accept the entity enclosed in the request as a new subordinate of the web resource identified by the URI. |
PUT |
Update the specified resource. |
PATCH |
Modify the specified resource by importing new or modified attributes into it. |
DELETE |
Delete the specified resource. |
Media Types
The following media types are supported by the Commerce REST API:
-
application/json
-
application/w-www-form-urlencoded
Supported Headers
The Commerce REST API supports the following headers that may be passed in the header section of the HTTP request.
Header | Description | Example |
Accept-Encoding |
List of acceptable encodings to support compression. | Accept-Encoding: gzip |
Content-Encoding |
List of acceptable encodings to support compression. | Content-Encoding: deflate |
Content-Type |
Media type of the body of the request. Required for POST and PUT requests. | Content-Type: application/json |
accept-language |
The expected language for the response | accept-language: en-US |
x-ccasset-language |
The language locale of the request data, for PUT/POST. For example, when you need to update the German description for a product, but if there's an error, you want the error response text to come back using the accept-language header value, which may not be German. | x-ccasset-language: de-DE |
x-ccsite |
On an instance running multiple sites, specifies which site the request applies to. | x-ccsite: siteUS |
Compression
Use compression on the Commerce REST resource request and response for improved performance. To use compression, include one of the following HTTP headers in the request: Accept-Encoding
orContent-Encoding
.