/api/customers/insert
{
"key": "Loremipsumdolorsitametconsecteturadipiscingelitlaoreet",
"owner_code": "netstorming",
"dry_run": true,
"customers": [...]
}
Request parameters:
| Key | Compulsory | Value type | Max length | Notes |
|---|---|---|---|---|
| key | yes | varchar | API Key provided by Netstorming | |
| owner_code | yes | varchar | 3-12 alphanumeric chars | Owner you want the new customers belongs to |
| customers | yes | list of objects | see below: Customer parameters | List of customers data to be inserted |
| dry_run | no | bool | If true, just performs a dry-run execution. Validity checks will be performed buth nothing will be written into databse. Useful for develpement purposes |
Request.customer parameters:
| Key | Compulsory | Value type | Max length | Notes |
|---|---|---|---|---|
| code | yes | varchar | 3-12 alphanumeric chars | Customer code in Netstorming sytstem |
| name | yes | varchar | 1-100 chars | Customer name / company name |
| address | yes | varchar | 1-150 chars | |
| zip | yes | varchar | 8 numbers | |
| country | yes | varchar | 2 chars | Country code (ISO 3166-1 alpha-2) |
| city | yes | varchar | 3-4 chars | Netstorming city code |
| mailstaff | yes | max 100 chars | Main customer email | |
| notify_lang | yes | varchar | 2 chars | Customer notification language |
| telephone | yes | varchar | 1-20 numbers | |
| fax | yes | varchar | 1-20 numbers | |
| currency | yes | varchar | 3 chars | ISO 4217 currency code |
| booking_online | yes | bool | Enable customer to perform online bookings (otherwise it can run availability only) | |
| blocked_in_deadline | yes | bool | Block reservations in deadline asking for prepayment with cc at the time of creation | |
| credit_card | yes | bool | Allow client to pay with credit card | |
| admin_user_name | yes | varchar | 1-50 chars | |
| admin_user_email | yes | max 100 chars | ||
| admin_user_login | yes | varchar | 3-12 alphanumeric chars | |
| admin_user_psw | yes | varchar | 6-12 chars | |
| admin_user_foreign_code | no | varchar | 1-100 chars | Foreign code |
| vat | no | varchar | 30 chars | |
| corporatename | no | varchar | 1-100 chars | |
| mailaccountability | no | max 100 chars | ||
| tax_code | no | varchar | max 100 chars | |
| markuphotelsweb | no | int | ||
| markupcarsweb | no | int | ||
| markuptransfersweb | no | int | ||
| markuptoursweb | no | int | ||
| markupgenericservicesweb | no | int | ||
| sdi_code | no | varchar | 7 chars | |
| accounting | no | varchar | 1-20 chars | |
| mobile_phone | no | varchar | 1-20 numbers | |
| pec_address | no | max 100 chars | ||
| force_contextual_payment | no | bool | Force customer to pay reservation in advance, even if they are not in deadline yet | |
| customer_homepage | no | enum | [HOME, HOTELSONLINE, BOOKINGSMANAGEMENT] | |
| emergency_number | no | varchar | 1-20 numbers | |
| payment_date | no | enum | [topay, deadline, startdate] | |
| prepayment_days | no | int | [0-30] | |
| block_voucher | no | bool | ||
| booking_autocancellation | no | bool | Automatically cancel unpaid bookings before the deadline date (usually 1 hour before) | |
| hotels_credit | no | int | If you want to disable, set to 0 | |
| cars_credit | no | int | If you want to disable, set to 0 | |
| transfers_credit | no | int | If you want to disable, set to 0 | |
| tours_credit | no | int | If you want to disable, set to 0 | |
| additional_users | no | list of objects | see below: User parameters | List of additional users to be inserted (other than the admin one) |
Request.customer.additional_user parameters:
| Key | Compulsory | Value type | Max length | Notes |
|---|---|---|---|---|
| name | yes | varchar | 1-50 chars | |
| yes | max 100 chars | |||
| login | yes | varchar | 3-12 alphanumeric chars | |
| psw | yes | varchar | 6-12 chars | |
| role | yes | enum | [admin, user, limited_access_user] |
{
"dry_run": true,
"results": [
{
"code": "test0123",
"customer": false,
"user": false
}
],
"errors": [
{
"line/index": 1,
"errors": [
"missing address",
"invalid notify_lang",
"invalid booking_online (valid values: yes, no, y, n, true, false, 1, 0)"
]
}
]
}
Response parameters:
| Key | Compulsory | Value type | Notes |
|---|---|---|---|
| dry_run | no | bool | Echo-value of the dry_run parameter in request |
| results | yes | list of objects | one object for each customer, holding the insert results (more deails below) |
| errors | yes | list of objects | one object for each errpr, if any (more deails below) |
Response.results parameters:
| Key | Compulsory | Value type | Notes |
|---|---|---|---|
| code | yes | string | Echo-value of the dry_run parameter in request |
| customer | yes | bool | Result of insert operation of customer. true = ok, false = failed |
| user | yes | bool | Result of insert operation of user. true = ok, false = failed. Always be false if customer = false |
Response.errors parameters:
| Key | Compulsory | Value type | Notes |
|---|---|---|---|
| line/index | yes | int | Index of item that generates the error |
| errors | yes | list of strings | Human-readable validation errors on the requested data |
You can find an example here