Changes

stoney core: Resellers Resource - REST API

1,541 bytes added, 10:00, 5 August 2014
/* Reseller creation response message */
Also visit [[stoney core: Resellers Resource Mapping (REST - LDAP)]].
 
= Overview =
The REST API describes the ('''Re'''presentational '''S'''tate '''T'''ransfer '''A'''pplication '''P'''rogramming '''I'''nterface) of the resellers resource to be used by [[:Category:stoney core|stoney core]], [[:Category:stoney conductor|stoney conductor]] and other [[:Category:Self-Service Modules|Self-Service Modules]] or third party applications.
* Update an existing reseller ([[#Reseller_update_.28PUT.29|PUT]]).
* Update one or more values of an existing reseller ([[#Reseller_partly_update_.28PATCH.29|PATCH]]).
* Delete a single reseller ([[I#Reseller_deletion_.28DELETE.29|DELETE]]).
To get an idea what happens behind the screens, have a look at the [[stoney core: Resellers Resource Mapping (REST - LDAP)]] documentation located in the [[:Category:Mapping (REST - LDAP)|Mapping (REST - LDAP)]] category.
= Resellers resource methods =
== Reseller creation (POST) ==
To create a new reseller the client needs to send a HTTP <code>POST</code> request on the reseller collection resource URI <code>https://api.example.com/v1/resellers</code> (also see [[Application_Programming_Interface_(API)#Base_URI|Base URI]]), including the associated reseller informationsinformation.The service will generate a new reseller and responds with a HTTP status code <code>201</code> (Created) on success. The newly created reseller URI is returned within the HTTP location header, which can be used by the client to gather informations information about the new reseller.
=== Reseller creation request message ===
| [[#Reseller_creation_request_message_body|Request body]]
| JSON object
| <presource lang="javascript">{ ... }</presource>
|}
|string
|yes
|The reseller's display name. Mostly the same as the <code>organizationName</code> or the <code>givenName</code> and <code>surname</code> out of the [[#billingAddress_object|billingAddress object]], but can also be the name of a brand.|UTF-8 {64}
|
|
|<source lang="javascript">"resellerName": "Super-duper HostingReseller Ltd."</source>
|-
|object
|yes
|An object holding the billing address informations information for the given reseller. Refer to the [[#billingAddress_object|billingAddress object table]] for more informationsinformation.
|
|
|object
|no
|An object holding the shipping address informations information for the given reseller. Refer to the [[#shippingAddress_object|shippingAddress object table]] for more informationsinformation.
|
|
|yes
|The given name (first name or forename) of the address holder.
|UTF-8 {64}
|@TODO: Add regex
|
|yes
|The surname (last name or family name) of the address holder.
|UTF-8 {64}
|@TODO: Add regex
|
</pre>
|<pre>
Content-Type: Content-Type: application/json; charset=UTF-8
Location: https://api.example.com/v1/resellers/4000001
</pre>
| [[#Reseller_creation_response_message_body|Response body]]
| JSON object
| <sourcen source lang="javascript">{ ... }</source>
|}
|object
|no
|In case of a failure, an error object with the appropriate error messages will be returned. Refer to the [[stoney_core:_REST_API#Error_codes_and_responses|Error codes and response chapter]] for more informationsinformation.
|
|
The service responds with a HTTP status code 200 (OK) on success and returns the various resellers.
Note that the service will only return a limited amount of objects at once and provides links for retrieving further objects. Refer to the [[stoney_core:_REST_API#Pagination|Pagination chapter]] for more informationsinformation. ==== Sort ====If you don't add a sort attribute, the collection will be sorted by '''id''' (ascending). If you would like a sorted collection answer, the query parameter sort must be added with the object's sort attribute(s) as the value: <code>https://api.example.com/v1/resellers?sort=resellerName,isActive</code>. For further information on filtering, sorting and searching, visit [[stoney_core:_REST_API#Filtering.2C_sorting_and_searching | stoney core: REST API]]. ==== Search (fulltext) ====To form a fulltext search (resellers only), append the url query parameter '''q''' with the desired search text: <code>https://api.example.com/v1/resellers?q=example</code>. The document [[stoney_core:_Search_Resource_-_REST_API#Resellers_Search_.28GET.29 | stoney core: Search Resource - REST API]] describes the search in detail. ==== Search (with filter) ====To form a specific search, append the url query attribute(s) name (for example '''resellerName''') with the desired search text: <code>https://api.example.com/v1/resellers?resellerName=example</code>. You're allowed to search for all attributes that are returned in the [[#Reseller_element_retrieval_response_message_body | Reseller element retrieval response message body]].
==== Reseller collection retrieval request message ====
| Status Line
| <pre>HTTP/1.1 <HTTP-Status-Code> <HTTP-Status-Message></pre>
| <pre>HTTP/1.1 201 Created200 OK</pre>
|-
| [[#reseller_collection_retrieval_response_object|Response body]]
| JSON object
| <presource lang="javascript">{ ... }</presource>
|}
"isCompany": true,
"isActive": true,
"resellerName": "Reseller Ltd." "countryCode": "CH", "postalCode": "3012", "localityName": "Bern"
},
{
|object
|no
|In case of a failure, an error object with the appropriate error messages will be returned. Refer to the [[stoney_core:_REST_API#Error_codes_and_responses|Error codes and response chapter]] for more informationsinformation.
|
|
|string
|yes
|The reseller's display name. Mostly the same as the <code>organizationName</code> or the <code>givenName</code> and <code>surname</code> out of the [[#billingAddress_object|billingAddress object]], but can also be the name of a brand.
|
|
|
|<source lang="javascript">"resellerName": "SuperReseller Ltd."</source> |-duper Hosting|<code>countryCode</code>|string|yes|||@TODO: Add regex||<source lang="javascript">"countryCode": "CH"</source> |-|<code>postalCode</code>|string|yes|||@TODO: Add regex||<source lang="javascript">"postalCode": "3012"</source> |-|<code>localityName</code>|string|yes|||@TODO: Add regex||<source lang="javascript">"localityName": "Bern</source>
|}
=== Reseller element retrieval (GET) ===
To retrieve an existing reseller and fetch the informations information associated with it, the client needs to send a HTTP <code>GET</code> request on the reseller's element resource URI (such as <code>https://api.example.com/v1/resellers/4000001</code>.The service responds with a HTTP status code 200 (OK) on success and returns the associated reseller informationsinformation.
==== Reseller element retrieval request message ====
| Status Line
| <pre>HTTP/1.1 <HTTP-Status-Code> <HTTP-Status-Message></pre>
| <pre>HTTP/1.1 201 Created200 OK</pre>
|-
|string
|yes
|The reseller's display name. Mostly the same as the <code>organizationName</code> or the <code>givenName</code> and <code>surname</code> out of the [[#billingAddress_object|billingAddress object]], but can also be the name of a brand.
|
|
|
|<source lang="javascript">"resellerName": "Super-duper HostingReseller Ltd."</source>
|-
|object
|yes
|An object holding the billing address informations information for the given reseller. Refer to the [[#billingAddress_object|billingAddress object table]] for more informationsinformation.
|
|
|object
|no
|An object holding the shipping address informations information for the given reseller. Refer to the [[#shippingAddress_object|shippingAddress object table]] for more informationsinformation.
|
|
|
|
|<source lang="javascript">"locationcustomers": "https://api.example.com/v1/resellers/4000001/customers"</source>
|-
|
|
|<source lang="javascript">"locationemployees": "https://api.example.com/v1/resellers/4000001/employees"</source>
|-
|
|
|<source lang="javascript">"locationusers": "https://api.example.com/v1/resellers/4000001/users"</source>
|-
|object
|no
|In case of a failure, an error object with the appropriate error messages will be returned. Refer to the [[stoney_core:_REST_API#Error_codes_and_responses|Error codes and response chapter]] for more informationsinformation.
|
|
==== Reseller update response message body ====
On success (<code>200</code>) an empty response message body will be returned, otherwise an [[stoney_core:_REST_API#Error_codes_and_responses|error object]] will provide further informations information about the failure.
== Reseller partly update (PATCH) ==
==== Reseller partly update request message body ====
The JSON message body consists out of one or more fields from the [[#reseller_object|Reseller object]].
@TODO: Add example.
=== Reseller partly update response message ===
==== Reseller partly update response message body ====
On success (<code>200</code>) an empty response message body will be returned, otherwise an [[stoney_core:_REST_API#Error_codes_and_responses|error object]] will provide further informations information about the failure. @TODO: Add example.
== Reseller deletion (DELETE) ==
To delete an existing reseller, the client needs to send a HTTP <code>DELETE</code> request , with an empty request body on the reseller's element resource URI (such as, <code>https://api.example.com/v1/resellers/4000001</code>). The service responds with a HTTP status code <code>200</code> (OK) on success and returns an empty body.
=== Reseller deletion request message ===
Accept: <Type>/<Subtype>
Accept-Charset: <Charset>
Content-Type: <Type>/<Subtype>; charset=<Charset>
</pre>
| <pre>
Accept: application/json
Accept-Charset: UTF-8
Content-Type: application/json; charset=UTF-8
</pre>
|-
| [[#Reseller_update_request_message_body|Request body]]| JSON object<Empty>| <source lang="javascript"pre>{ ... }</sourcepre>
|}
 
==== Reseller deletion request message body ====
The JSON message body consists out of one or more fields from the [[#reseller_object|Reseller object]].
=== Reseller deletion response message ===
==== Reseller deletion response message body ====
On success (<code>200</code>) an empty response message body will be returned, otherwise an [[stoney_core:_REST_API#Error_codes_and_responses|error object]] will provide further informations information about the failure. == Reseller search ==The reseller search is a sub section of the [[stoney core: Search Resource - REST API]] and is described there in more detail.
= Links =
* [[stoney_corestoney core: REST API]]
[[Category:REST API]][[Category:stoney core]]
SLB, editor, reviewer
3,368
edits