Changes

stoney core: Customers Resource - REST API

0 bytes added, 15:07, 19 May 2014
|<pre>
Content-Type: Content-Type: application/json; charset=UTF-8
Location: https://api.example.com/v1/customers/40000015000001
</pre>
|@TODO add regex
|
|<source lang="javascript">"id": 40000015000001</source>
|-
|
|
|<source lang="javascript">"location": "https://api.example.com/v1/customers/40000015000001"</source>
|-
[
{
"id": 40000005000000, "location": "https://api.example.com/v1/customers/40000005000000",
"isCompany": true,
"isActive": true,
|@TODO add regex
|
|<source lang="javascript">"id": 40000005000000</source>
|-
|
|
|<source lang="javascript">"location": "https://api.example.com/v1/customers/40000005000000"</source>
|-
=== Customer element retrieval (GET) ===
To retrieve an existing customer and fetch the informations associated with it, the client needs to send a HTTP <code>GET</code> request on the customer's element resource URI (such as <code>https://api.example.com/v1/customers/40000015000001</code>.
The service responds with a HTTP status code 200 (OK) on success and returns the associated customer informations.
</pre>
|<pre>
GET /v1/customers/4000001 5000001 HTTP 1.1
HOST: api.example.com
</pre>
|<pre>
Content-Type: Content-Type: application/json; charset=UTF-8
Location: https://api.example.com/v1/customers/40000015000001
</pre>
|@TODO add regex
|
|<source lang="javascript">"id": 40000015000001</source>
|-
|
|
|<source lang="javascript">"customers": "https://api.example.com/v1/customers/40000015000001/customers"</source>
|-
|
|
|<source lang="javascript">"employees": "https://api.example.com/v1/customers/40000015000001/employees"</source>
|-
|
|
|<source lang="javascript">"users": "https://api.example.com/v1/customers/40000015000001/users"</source>
|-
== Customer update (PUT) ==
To updates an existing customer, the client needs to send a HTTP <code>PUT</code> request on the customer's element resource URI (such as, <code>https://api.example.com/v1/customers/40000015000001</code>).
The service responds with a HTTP status code 200 (OK) on success and returns an empty body.
</pre>
|<pre>
PUT /v1/customers/4000001 5000001 HTTP 1.1
HOST: api.example.com
</pre>
== Customer partly update (PATCH) ==
To update fields of an existing customer, the client needs to send a HTTP <code>PATCH</code> request on the customer's element resource URI (such as, <code>https://api.example.com/v1/customers/40000015000001</code>).
The service responds with a HTTP status code 200 (OK) on success and returns an empty body.
</pre>
|<pre>
PATCH /v1/customers/4000001 5000001 HTTP 1.1
HOST: api.example.com
</pre>
== Customer deletion (DELETE) ==
To delete an existing customer, the client needs to send a HTTP <code>DELETE</code> request, with an empty request body on the customer's element resource URI (such as, <code>https://api.example.com/v1/customers/40000015000001</code>). The service responds with a HTTP status code <code>200</code> (OK) on success and returns an empty body.
=== Customer deletion request message ===
</pre>
|<pre>
DELETE /v1/customers/4000001 5000001 HTTP 1.1
HOST: api.example.com
</pre>
SLB, editor, reviewer
3,368
edits