Changes

stoney core: Customers Resource - REST API

7,420 bytes removed, 15:32, 19 May 2014
The service will generate a new customer and responds with a HTTP status code <code>201</code> (Created) on success. The newly created customer URI is returned within the HTTP location header, which can be used by the client to gather informations about the new customer.
We have two types of customers:* '''Company customer''': where we actually have a proper company or business name.* '''Private customer''': where we have the given name and the surname of the customer. === Company customer Customer creation request message ===
{| class="wikitable sortable" style="width: 100%;"
|-
|-
| [[#Company_customer_creation_request_message_bodyCustomer_creation_request_message_body|Request body]]
| JSON object
| <source lang="javascript">{ ... }</source>
|}
==== Company customer Customer creation request message body ===={| class="wikitable sortable" style="width: 100%;" id="company_customer_objectcustomer_object"
|-
|+ align="top" style="text-align:left;"|Company Customer Object
! Parameter name
! Data type
|
|<source lang="javascript">"customerName": "Super-duper Hosting"</source>
 
|-
|<code>id</code>
|integer
|yes
|The identification number the newly created customer resource should belong to.
|
|@TODO add regex
|
|<source lang="javascript">"belongsToResellerID": 4000001</source>
|-
{
"organizationName": "Customer Ltd.",
"gender": 'm',
"givenName": "Name",
"surname": "Surname",
"postalAddress": "Street Number",
"countryCode": "CH",
"postalCode": "1234",
"localityName": "Locality",
"preferredLanguage": "en-GB",
"mail": "name.surname@example.com",
"telephoneNumber": "+41 00 000 00 00",
"mobileTelephoneNumber": "+41 00 000 00 00",
"websiteURL": "https://www.example.com/"
}
</source>
 
|}
 
{| class="wikitable sortable" style="width: 100%;" id="billingAddress_object"
|-
|+ align="top" style="text-align:left;"|billingAddress Object
!Parameter name
!Data type
!Mandatory
!Description
!Valid content
![http://www.pcre.org/ PCRE]
!Default value
!Example
 
|-
|<code>organizationName</code>
|string
|no
|The name of the organization.
|
|@TODO: Add regex
|
|<source lang="javascript">"organizationName": "Customer Ltd."</source>
 
|-
|<code>gender</code>
|string
|yes
|The gender of the address holder
|Either <code>f</code> for female, <code>m</code> for male or <code>n</code> for neutral.
|
|
|<source lang="javascript">"gender": "f"</source>
 
|-
|<code>givenName</code>
|string
|yes
|The given name (first name or forename) of the address holder.
|UTF-8 {64}
|@TODO: Add regex
|
|<source lang="javascript">"givenName": "Name"</source>
 
|-
|<code>surname</code>
|string
|yes
|The surname (last name or family name) of the address holder.
|UTF-8 {64}
|@TODO: Add regex
|
|<source lang="javascript">"surname": "Surname"</source>
 
|-
|<code>postalAddress</code>
|string
|yes
|
|
|@TODO: Add regex
|
|<source lang="javascript">"postalAddress": ""</source>
 
|-
|<code>countryCode</code>
|string
|yes
|
|
|@TODO: Add regex
|
|<source lang="javascript">"countryCode": ""</source>
 
|-
|<code>postalCode</code>
|string
|yes
|
|
|@TODO: Add regex
|
|<source lang="javascript">"postalCode": ""</source>
 
|-
|<code>localityName</code>
|string
|yes
|
|
|@TODO: Add regex
|
|<source lang="javascript">"localityName": ""</source>
 
|-
|<code>preferredLanguage</code>
|string
|yes
|
|
|@TODO: Add regex
|
|<source lang="javascript">"preferredLanguage": ""</source>
 
|-
|<code>mail</code>
|string
|yes
|
|
|@TODO: Add regex
|
|<source lang="javascript">"mail": ""</source>
 
|-
|<code>telephoneNumber</code>
|string
|yes
|
|
|@TODO: Add regex
|
|<source lang="javascript">"telephoneNumber": ""</source>
 
|-
|<code>mobileTelephoneNumber</code>
|string
|yes
|
|
|@TODO: Add regex
|
|<source lang="javascript">"mobileTelephoneNumber": ""</source>
 
|-
|<code>websiteURL</code>
|string
|yes
|
|
|@TODO: Add regex
|
|<source lang="javascript">"websiteURL": ""</source>
 
|}
 
{| class="wikitable sortable" style="width: 100%;" id="shippingAddress_object"
|-
|+ align="top" style="text-align:left;"|shippingAddress Object
!Parameter name
!Data type
!Mandatory
!Description
!Valid content
![http://www.pcre.org/ PCRE]
!Default value
!Example
 
|-
|<code>organizationName</code>
|string
|no
|The name of the organization.
|
|@TODO: Add regex
|
|<source lang="javascript">"organizationName": "Customer Ltd."</source>
 
|-
|<code>gender</code>
|string
|yes
|The gender of the address holder
|Either <code>f</code> for female, <code>m</code> for male or <code>n</code> for neutral.
|
|
|<source lang="javascript">"gender": "f"</source>
 
|-
|<code>givenName</code>
|string
|yes
|The given name (first name or forename) of the address holder.
|
|@TODO: Add regex
|
|<source lang="javascript">"givenName": "Name"</source>
 
|-
|<code>surname</code>
|string
|yes
|The surname (last name or family name) of the address holder.
|
|@TODO: Add regex
|
|<source lang="javascript">"surname": "Surname"</source>
 
|-
|<code>postalAddress</code>
|string
|yes
|
|
|@TODO: Add regex
|
|<source lang="javascript">"postalAddress": ""</source>
 
|-
|<code>countryCode</code>
|string
|yes
|
|
|@TODO: Add regex
|
|<source lang="javascript">"countryCode": ""</source>
 
|-
|<code>postalCode</code>
|string
|yes
|
|
|@TODO: Add regex
|
|<source lang="javascript">"postalCode": ""</source>
 
|-
|<code>localityName</code>
|string
|yes
|
|
|@TODO: Add regex
|
|<source lang="javascript">"localityName": ""</source>
 
|-
|<code>preferredLanguage</code>
|string
|yes
|
|
|@TODO: Add regex
|
|<source lang="javascript">"preferredLanguage": ""</source>
 
|-
|<code>mail</code>
|string
|yes
|
|
|@TODO: Add regex
|
|<source lang="javascript">"mail": ""</source>
 
|-
|<code>telephoneNumber</code>
|string
|yes
|
|
|@TODO: Add regex
|
|<source lang="javascript">"telephoneNumber": ""</source>
 
|-
|<code>mobileTelephoneNumber</code>
|string
|yes
|
|
|@TODO: Add regex
|
|<source lang="javascript">"mobileTelephoneNumber": ""</source>
 
|-
|<code>websiteURL</code>
|string
|yes
|
|
|@TODO: Add regex
|
|<source lang="javascript">"websiteURL": ""</source>
 
|}
 
==== Customer creation request message body (Private Customer) ====
{| class="wikitable sortable" style="width: 100%;" id="customer_object"
|-
|+ align="top" style="text-align:left;"|Customer Object
! Parameter name
! Data type
! Mandatory
! Description
! Valid content
![http://www.pcre.org/ PCRE]
! Default value
! Example
 
|-
|<code>isCompany</code>
|boolean
|yes
|<code>true</code> if the customer represents a company, <code>false</code> if it's an individual person.
|<code>true</code> or <code>false</code>
|
|
|<source lang="javascript">"isCompany": false</source>
 
|-
|<code>isActive</code>
|boolean
|yes
|
|<code>true</code> or <code>false</code>
|
|<code>true</code>
|<source lang="javascript">"isActive": true</source>
 
|-
|<code>customerName</code>
|string
|yes
|The customer'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">"customerName": "Name Surname"</source>
 
|-
|<code>id</code>
|integer
|yes
|The identification number the newly created customer resource should belong to.
|
|@TODO add regex
|
|<source lang="javascript">"belongsToResellerID": 4000001</source>
 
|-
|[[#billingAddress_object|<code>billingAddress</code>]]
|object
|yes
|An object holding the billing address informations for the given customer. Refer to the [[#billingAddress_object|billingAddress object table]] for more informations.
|
|
|
|<source lang="javascript">
"billingAddress":
{
"gender": 'm',
"givenName": "Name",
"surname": "Surname",
"postalAddress": "Street Number",
"countryCode": "CH",
"postalCode": "1234",
"localityName": "Locality",
"preferredLanguage": "en-GB",
"mail": "name.surname@example.com",
"telephoneNumber": "+41 00 000 00 00",
"mobileTelephoneNumber": "+41 00 000 00 00",
"websiteURL": "https://www.example.com/"
}
</source>
 
|-
|[[#shippingAddress_object|<code>shippingAddress</code>]]
|object
|no
|An object holding the shipping address informations for the given customer. Refer to the [[#shippingAddress_object|shippingAddress object table]] for more informations.
|
|
|
|<source lang="javascript">
"shippingAddress":
{
"gender": 'm',
"givenName": "Name",
SLB, editor, reviewer
3,368
edits