User Management =============== Index ------------ User management resources: - [List of all users](#users) - [Get a user detail](#user) - [Create a new user](#post-user) - [Update user](#put-user) - [Password reset](#pass-reset) Billing profile management resources: - [List of all billing profiles](#billlings) - [Get a billing profile detail](#billling) - [Create a new billing profile](#post-billling) - [Update billing profile](#put-billling) - [Delete billing profile](#delete-billling) Domain profile management resources: - [List of all domain profiles](#domainProfiles) - [Get a domain profile](#domainProfile) - [Create new domain profile](#post-domainProfile) - [Update domain profile](#put-domainProfile) - [Delete domain profile](#delete-domainProfile) List of all users {#users} -------------------------- Method for listing all users. - **User**: can order and manage all services under his account including subuser and subadmin accounts - **Subadmin**: can manage only services (web, DNS, mail, SQL) allowed by User Available parameters: - `page` (int, not required) - `pagesize` (int, not required) Example of usage: add `?page=1&pagesize=20` to the end of the address. Default page size is unlimited. >Curl ```sh curl "https://rest.websupport.sk/v1/user" -v -u key:signature -H "Date: request_date_time" ``` >Request ```http GET https://rest.websupport.sk/v1/user HTTP/1.1 Accept: application/json ``` >Response `200` ```json { "items": [ { "id": 123, "login": "testaccount", "parentId": null, "active": true, "createTime": 1279829310, "group": "users" }, { "id": 456, "login": "subuseraccount", "parentId": 14288, "active": true, "createTime": 1340884337, "group": "subadmins" } ], "pager": { "page": 1, "pagesize": null, "items": 2 } } ``` Get a user detail {#user} ------------------------- You can get info by user ID or by currently logged user if you use the string "self" ex.: `https://rest.websupport.sk/v1/user/self` >Curl ```sh curl "https://rest.websupport.sk/v1/user/:id" -v -u key:signature -H "Date: request_date_time" ``` >Request ```http GET https://rest.websupport.sk/v1/user/:id HTTP/1.1 Accept: application/json ``` >Response `200` ```json { "id": 123, "login": "testaccount", "parentId": null, "active": true, "createTime": 1279829310, "group": "users", "email": "myemail@mydomain.com", "phone": "123456789", "sknicHandle": "", "contactPerson": "", "resellerToken": "", "credit": 0, "verifyUrl": "https://rest.websupport.sk/v1/user/verify/key/3ccefe196de91b0ccf1be7e02bfdb450fd4016890d5ea2f4678b68f93498ff08", "billing": [ { "id": 357, "profile": "default", "isDefault": true, "name": "Company s.r.o.", "city": "Lorem Ipsum", "street": "Dolor sit 128", "companyRegId": "", "taxId": "", "vatId": "", "zip": "98464", "country": "sk", "isic": "" }, { "id": 159, "profile": "personal", "isDefault": false, "name": "Lorizzle ipsizzle", "city": "Dolor Sit", "street": "Amet 256", "companyRegId": "", "taxId": "", "vatId": "", "zip": "45468", "country": "sk", "isic": "" } ], "market": { "name": "Slovensko", "identifier": "sk", "currency": "EUR" } } ``` >Response `404` (not found) ```json { "message": "User not found.", "code": 404 } ``` Create a new user {#post-user} ------------------------------ This method is available without authentication, but if you want to create subuser (with `isSubUser` attribute set to `true`) login is required. #### Parameters: | Name | Type | Required | Comment | |---------------|--------|----------|--------------------------------------| | market | string | no | 2-letter market identifier, default `sk`, values: `sk` (Slovakia), `cz` (Czech Republic), `hu` (Hungary) or `at` (Austria) | | isSubUser | bool | no | if true, user is added as your subuser and you can manage his settings, services etc. Requires authentication! | | **login** | string | yes | your login | | **password** | string | yes | plain password | | **email** | string | yes | you can put multiple e-mail addresses separated by comma (`,`) | | **name** | string | yes | company name or your full name | | **city** | string | yes | city | | **street** | string | yes | street + number | | **zip** | string | yes | area ZIP code | | **country** | string | yes | two-letter country identifier, ex. 'SK' for Slovakia (see more about [identifiers](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)) | | **phone** | string | yes | used for SMS notifications etc. | | **confirmTerms** | bool | yes | confirm Terms and Conditions | | contactPerson | string | no | contact person in your company | | companyRegId | string | no | company registration ID (IČO in Slovakia or Czech Republic) | | taxId | string | no | tax ID (DIČ in Slovakia or Czech Republic) | | vatId | string | no | Value-added Tax (VAT) ID (IČ-DPH in Slovakia or Czech Republic) | | isic | string | no | ISIC student identification card number - only for `sk` market | *only for `cz` market >Curl ```sh curl "https://rest.websupport.sk/v1/user" -H "Content-Type: application/json" -H "Date: request_date_time" -X POST \ -d '{"market":"sk","login":"login","password":"password","email":"test@test.com","name":"Company s.r.o.","city":"Lorem","street":"Ipsum 12","zip":"123456","country":"sk"}' \ -u key:signature ``` >Request ```http POST https://rest.websupport.sk/v1/user HTTP/1.1 Accept: application/json Content-Type: application/json { "market": "sk", "login": "login", "password": "password", "email": "test@test.com", "name": "Company s.r.o.", "city": "Lorem", "street": "Ipsum 12", "zip": "123456", "country": "sk" } ``` >Response `201` (success) ```json { "status": "success", "item": { "id": 73379, "billingId": 77752, "market": "sk", "group": "users", "parentId": null, "login": "login", "email": "test@test.com", "password": "password", "name": "Company s.r.o.", "city": "Lorem", "street": "Ipsum 12", "zip": "123456", "country": "sk", "companyRegId": "", "taxId": "", "vatId": "", "contactPerson": "", "phone": "", "isic": "" }, "errors": [ ] } ``` >Response `200` (validation error) ```json { "status": "error", "item": { "id": null, "billingId": null, "market": "sk", "group": "users", "parentId": null, "login": "a", "email": "test@test.com", "password": "password", "name": "Company s.r.o.", "city": "Lorem", "street": "Ipsum 12", "zip": "123456", "country": "sk", "companyRegId": "", "taxId": "", "vatId": "", "contactPerson": "", "phone": "", "isic": "" }, "errors": { "login": [ "Login is too short (minimum is 3 characters)." ], "market": [ "Wrong market!" ] } } ``` Update user {#put-user} ----------------------- If you change the password field, don't forget to use this new password in the next API request. The old password may be working for up to a minute after you change it, but do not rely on it. As always, you can use the `self` identifier instead of a user id to edit the currently logged user. #### Parameters: | Name | Type | Required | Comment | |---------------|--------|----------|--------------------------------------| | password | string | no | plain password | | email | string | no | you can put multiple e-mail addresses separated by comma (`,`) | | phone | string | no | used for SMS notifications etc. | | contactPerson | string | no | contact person in your company | | userLanguage | string | no | language used to send notifications, values `sk` (slovak), `cs` (czech), `hu` (hungarian), `de` (german), `en` (english), `sv` (swedish) | Please note that some fields (`name`, `city`, `street`, `zip`, `country`, `companyRegId`, `taxId`, `vatId`, `isic`) you used in [create a new user](#post-user) method can be modified only in [update billing profile](#put-billling) method. >Curl ```sh curl "https://rest.websupport.sk/v1/user/:id" -H "Content-Type: application/json" -H "Date: request_date_time" -X PUT \ -d '{"email":"mynew@email.com", "password": "newpass4321"}' -u key:signature ``` >Request ```http PUT https://rest.websupport.sk/v1/user/:id HTTP/1.1 Accept: application/json Content-Type: application/json { "email":"mynew@email.com", "password": "newpass4321" } ``` >Response `201` (success) ```json { "status": "success", "item": { "id": 73379, "login": "login", "email": "mynew@email.com", "password": "password", "phone": "", "contactPerson": "" }, "errors": [ ] } ``` >Response `200` (validation error) ```json { "status": "error", "item": { "id": 73379, "login": "login", "email": "a", "password": "a", "phone": "", "contactPerson": "" }, "errors": { "email": [ "Email is too short (minimum is 3 characters)." ], "password": [ "Password is too short (minimum is 3 characters)." ] } } ``` >Response `404` (not found) ```json { "message": "User not found.", "code": 404 } ``` Password reset {#pass-reset} --------------------------- >Curl ```sh curl "https://rest.websupport.sk/v1/user/restorepass" -H "Content-Type: application/json" -H "Date: request_date_time" -X POST \ -d '{"login":"mylogin"}' -u key:signature ``` >Request ```http POST https://rest.websupport.sk/v1/user/restorepass HTTP/1.1 Accept: application/json Content-Type: application/json { "login":"mylogin" } ``` >Response `201` (success) ```json { "status": "success" } ``` >Response `200` (error) ```json { "status": "error", "errors": { "login": [ "Login field is required" ] } } ``` -------------------------- List of all billing profiles {#billlings} -------------------------- You can have more billing profiles with different billing details. Method for listing users billing profiles. You can use "self" as identifier for currently logged user of use user ID. Available parameters: - `page` (int, not required) - `pagesize` (int, not required) Example of usage: add `?page=1&pagesize=20` to the end of the address. Default page size is unlimited. >Curl ```sh curl "https://rest.websupport.sk/v1/user/:id/billing" -v -u key:signature -H "Date: request_date_time" ``` >Request ```http GET https://rest.websupport.sk/v1/user/:id/billing HTTP/1.1 Accept: application/json ``` >Response `200` ```json { "items": [ { "id": 357, "profile": "default", "isDefault": true, "name": "Company s.r.o.", "city": "Lorem Ipsum", "street": "Dolor sit 128", "companyRegId": "", "taxId": "", "vatId": "", "zip": "98464", "country": "sk", "isic": "" }, { "id": 159, "profile": "personal", "isDefault": false, "name": "Lorizzle ipsizzle", "city": "Dolor Sit", "street": "Amet 256", "companyRegId": "", "taxId": "", "vatId": "", "zip": "45468", "country": "sk", "isic": "" } ], "pager": { "page": 1, "pagesize": null, "items": 2 } } ``` >Response `404` (not found) ```json { "message": "User not found.", "code": 404 } ``` Get a billing profile detail {#billing} --------------------------------------- Get billing detail by ID. >Curl ```sh curl "https://rest.websupport.sk/v1/user/:id/billing/:billing_id" -v -u key:signature -H "Date: request_date_time" ``` >Request ```http GET https://rest.websupport.sk/v1/user/:id/billing/:billing_id HTTP/1.1 Accept: application/json ``` >Response `200` ```json { "id": 357, "profile": "default", "isDefault": true, "name": "Company s.r.o.", "city": "Lorem Ipsum", "street": "Dolor sit 128", "companyRegId": "", "taxId": "", "vatId": "", "zip": "98464", "country": "sk", "isic": "" } ``` >Response `404` (not found) ```json { "message": "Billing info not found.", "code": 404 } ``` Create a new billing profile {#post-billling} --------------------------------------------- #### Profile parameters: | Name | Type | Required | Default value | Comment | |--------------|--------|----------|---------------|--------------------------------------| | **profile** | string | yes | | Billing profile name. This field is not used in any invoice, it's only for your information | | isDefault | bool | no | false | Set this **true** if you want this profile set as primary billing profile | | **name** | string | yes | | Company name or your full name | | **city** | string | yes | | City | | **street** | string | yes | | Street + number | | **zip** | string | yes | | area ZIP code | | **country** | string | yes | | two-letter country identifier, ex. 'sk' for Slovakia (see more about [identifiers](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)) | | companyRegId | string | no | | company registration ID (IČO in Slovakia or Czech Republic) | | taxId | string | no | | tax ID (DIČ in Slovakia or Czech Republic) | | vatId | string | no | | Value-added Tax (VAT) ID (IČ-DPH in Slovakia or Czech Republic) | | isic | string | no | | ISIC Student Identification card number - only in Slovakia | >Curl ```sh curl "https://rest.websupport.sk/v1/user/:id/billing" -H "Content-Type: application/json" -H "Date: request_date_time" -X POST \ -d '{"profile":"my new profile", "name":"Company s.r.o.", "city": "Lorem", "street": "Ipsum 12", "zip": "123456", "country": "sk"}' \ -u key:signature ``` >Request ```http POST https://rest.websupport.sk/v1/user/:id/billing HTTP/1.1 Accept: application/json Content-Type: application/json { "profile":"my new profile", "name":"Company s.r.o.", "city": "Lorem", "street": "Ipsum 12", "zip": "123456", "country": "sk" } ``` >Response `201` (success) ```json { "status": "success", "item": { "id": 74429, "profile": "my new profile", "isDefault": false, "name": "Company s.r.o.", "city": "Lorem", "street": "Ipsum 12", "zip": "123456", "country": "sk", "companyRegId": "", "taxId": "", "vatId": "", "isic": "" }, "errors": [ ] } ``` >Response `200` (validation error) ```json { "status": "error", "item": { "id": null, "profile": "", "isDefault": false, "name": "Company s.r.o.", "city": "Lorem", "street": "Ipsum 12", "zip": "fsafdsa", "country": "aa", "companyRegId": "", "taxId": "", "vatId": "", "isic": "" }, "errors": { "profile": [ "Profile cannot be blank." ], "zip": [ "Zip code must be a number." ], "country": [ "Wrong country identifier." ] } } ``` >Response `404` (not found) ```json { "message": "User not found.", "code": 404 } ``` Update billing profile {#put-billling} -------------------------------------- #### Update parameters: | Name | Type | Required | Comment | |--------------|--------|----------|---------| | profile | string | no | Billing profile name, this field is not used in any invoice, it's only for your information | | isDefault | bool | no | Set this **true** if you want this profile set as primary billing profile | | name | string | no | Company name or your full name | | city | string | no | City | | street | string | no | Street + number | | zip | string | no | area ZIP code | | country | string | no | two-letter country identifier, ex. 'sk' for Slovakia (see more about [identifiers](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)) | | companyRegId | string | no | company registration ID (IČO in Slovakia or Czech Republic) | | taxId | string | no | tax ID (DIČ in Slovakia or Czech Republic) | | vatId | string | no | Value-added Tax (VAT) ID (IČ-DPH in Slovakia or Czech Republic) | | isic | string | no | ISIC Student Identification card number - only in Slovakia | >Curl ```sh curl "https://rest.websupport.sk/v1/user/:id/billing:billing_id" -H "Content-Type: application/json" -H "Date: request_date_time" -X PUT \ -d '{"name":"New Company s.r.o.", "isDefault": true}' -u key:signature ``` >Request ```http PUT https://rest.websupport.sk/v1/user/:id/billing/:billing_id HTTP/1.1 Accept: application/json Content-Type: application/json { "name":"New Company s.r.o.", "isDefault": true } ``` >Response `201` (success) ```json { "status": "success", "item": { "id": 74429, "profile": "my new profile", "isDefault": true, "name": "New Company s.r.o.", "city": "Lorem", "street": "Ipsum 12", "zip": "123456", "country": "sk", "companyRegId": "", "taxId": "", "vatId": "", "isic": "" }, "errors": [ ] } ``` >Response `200` (validation error) ```json { "status": "error", "item": { "id": null, "profile": "my new profile", "isDefault": true, "name": "a", "city": "Lorem", "street": "Ipsum 12", "zip": "123456", "country": "sk", "companyRegId": "", "taxId": "", "vatId": "", "isic": "" }, "errors": { "name": [ "Name is too short (minimum is 3 characters)." ] } } ``` >Response `404` (not found) ```json { "message": "User not found.", "code": 404 } ``` Delete billing profile {#delete-billling} ----------------------------------------- No parameters required. Note that deleting **default** profile is **blocked**! >Curl ```sh curl "https://rest.websupport.sk/v1/user/:id/billing/:billing_id" -X DELETE -u key:signature -H "Date: request_date_time" ``` >Request ```http DELETE https://rest.websupport.sk/v1/user/:id/billing/:billing_id HTTP/1.1 Accept: application/json ``` >Response `200` ```json { "status": "success", "item": { "id": 74429, "profile": "my new profile", "isDefault": true, "name": "New Company s.r.o.", "city": "Lorem", "street": "Ipsum 12", "zip": "123456", "country": "sk", "companyRegId": "", "taxId": "", "vatId": "", "isic": "" }, "errors": [ ] } ``` >Response `404` (not found) ```json { "message": "Billing info not found!", "code": 404 } ``` >Response `500` (error) ```json { "message": "Cannot delete default profile!", "code": 500 } ``` -------------------------- List of all domain profiles {#domainProfiles} -------------------------- Domain profiles allow you to manage contact information on your domains. Method for listing domain profiles. You can use "self" as identifier for currently logged user of use user ID. Available parameters: - `page` (int, not required) - `pagesize` (int, not required) Example of usage: add `?page=1&pagesize=20` to the end of the address. Default page size is unlimited. >Curl ```sh curl "https://rest.websupport.sk/v1/user/:id/domainProfile" -v -u key:signature -H "Date: request_date_time" ``` >Request ```http GET https://rest.websupport.sk/v1/user/:id/domainProfile HTTP/1.1 Accept: application/json ``` >Response `200` ```json { "items": [ { "id": "126", "firstName": "Meno", "lastName": "Priezvisko", "orgName": "Firma, s.r.o.", "street": "Lorem 44a", "city": "Košice", "zip": "04017", "country": "SK", "email": "firma@example.com", "phone": "+421.900123456", "identBirthday": "", "identVat": "SK123456", "identPassport": "", "identCompanyRegistration": "", "identIdentityCard": "" }, { "id": "127", "firstName": "Meno", "lastName": "Priezvisko", "orgName": null, "street": "Lorem 44a", "city": "Kosice", "zip": "04017", "country": "SK", "email": "osoba@example.com", "phone": "+421.900123456", "identBirthday": "1992-05-30", "identVat": "", "identPassport": "", "identCompanyRegistration": "", "identIdentityCard": "" } ], "pager": { "page": 1, "pagesize": null, "items": 2 } } ``` Get a domain profile profile {#domainProfile} --------------------------------------- Get domain profile by ID. >Curl ```sh curl "https://rest.websupport.sk/v1/user/:id/domainProfile/:domainProfileId" -v -u key:signature -H "Date: request_date_time" ``` >Request ```http GET https://rest.websupport.sk/v1/user/:id/domainProfile/:domainProfileId HTTP/1.1 Accept: application/json ``` >Response `200` ```json { "id": "153", "firstName": "Tesster", "lastName": "Priezvisko", "orgName": "company, s.r.o.", "street": "Stare Grunty 12", "city": "Kosice", "zip": "040 17", "country": "SK", "email": "test@example.com", "phone": "+421.900123456", "identBirthday": null, "identVat": null, "identPassport": null, "identCompanyRegistration": "123123123", "identIdentityCard": null, "domains": [], "pendingDomains": [], "changeRequest": [] } ``` >Response `404` (not found) ```json { "message": "Domain profile not found.", "code": 404 } ``` Create new domain profile {#post-domainProfile} --------------------------------------------- #### Profile parameters: | Name | Type | Required | Default value | Comment | |---------------------------|--------|----------|---------------|-----------------------------------------------------------------------| | **firstName** | string | yes | | First name | | **lastName** | string | yes | | Last name | | orgName | string | no | | Company name, if submitted a corporate domain profile will be created | | **street** | string | yes | | Street + house number | | **city** | string | yes | | City | | **zip** | string | yes | | Postcode | **country** | string | yes | | two-letter country identifier, ex. 'sk' for Slovakia (see more about [identifiers](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)) | | **email** | string | yes | | Valid email address (will be used to authorize any subsequent change to assigned domain profile) | **phone** | string | yes | | Phone number in a following form: +421900123456 | identCompanyRegistration | string | no | | Company registration ID (IČO in Slovakia or Czech Republic), required for company-registered .sk domains | identVat | string | no | | Value-added Tax (VAT) ID (IČ-DPH in Slovakia or Czech Republic) | | identIdentityCard | string | no | | Personal ID card number, required for registration of some tlds | | identBirthday | string | no | | Birthdate (yyyy-M-d), required for registration of some tlds | | identPassport | string | no | | Passport number, required for registration of some tlds | >Curl ```sh curl "https://rest.websupport.sk/v1/user/:id/domainProfile" -H "Content-Type: application/json" -H "Date: request_date_time" -X POST \ -d '{"firstName":"Tesster 2","lastName":"Priezvisko","orgName":"company, s.r.o.","street":"Stare Grunty 12","city":"Kosice","zip":"040 17","country":"SK","phone":"+421900123456","email":"test@example.com","identCompanyRegistration":"123123123"}' \ -u key:signature ``` >Request ```http POST https://rest.websupport.sk/v1/user/:id/domainProfile HTTP/1.1 Accept: application/json Content-Type: application/json { "firstName": "Tesster 2", "lastName": "Priezvisko", "orgName": "company, s.r.o.", "street": "Stare Grunty 12", "city": "Kosice", "zip": "040 17", "country": "SK", "phone": "+421900123456", "email": "test@example.com", "identCompanyRegistration": "123123123" } ``` >Response `201` (success) ```json { "status": "success", "item": { "id": "158", "firstName": "Tesster 2 Priezvisko", "orgName": "company, s.r.o.", "street": "Stare Grunty 12", "city": "Kosice", "zip": "040 17", "country": "SK", "phone": "0900123456", "email": "test@example.com", "identBirthday": null, "identVat": null, "identPassport": null, "identCompanyRegistration": "SK1234567", "identIdentityCard": null }, "errors": {} } ``` >Response `200` (validation error) ```json { "status": "error", "item": { "id": null, "firstName": "Tesster 2 Priezvisko", "lastName": null, "orgName": "company, s.r.o.", "street": "Stare Grunty 12", "city": "Kosice", "zip": "040 17", "country": "SK", "phone": "0900123456", "email": "test@example.com", "identBirthday": null, "identVat": null, "identPassport": null, "identCompanyRegistration": "SK1234567", "identIdentityCard": null }, "errors": { "lastName": [ "Last name cannot be blank." ], "phone": [ "Please specify valid phone number (+421900123456)" ], "identCompanyRegistration": [ "Not valid Company Reg. Id number" ] } } ``` Update domain profile {#put-domainProfile} -------------------------------------- #### Update parameters: Any of [create parameters](#post-domainProfile). It's not possible to switch between company and personal profiles or change identifiers (company reg. no, birthdate, etc.) once profile is assigned to a domain. >Curl ```sh curl "https://rest.websupport.sk/v1/user/:id/domainProfile/:domainProfileId" -H "Content-Type: application/json" -H "Date: request_date_time" -X PUT \ -d '{"name":"New Company s.r.o.", "isDefault": true}' -u key:signature ``` >Request ```http PUT https://rest.websupport.sk/v1/user/:id/domainProfile/:domainProfileId HTTP/1.1 Accept: application/json Content-Type: application/json { "firstName": "Jozef Premenovany", } ``` >Response `200` (success) ```json { "status": "success", "item": { "id": "150", "firstName": "Jozef Premenovany", "lastName": "Priezvisko", "orgName": null, "street": "Stare Grunty 12", "city": "Kosice", "zip": "040 17", "country": "SK", "phone": "+421.900123456", "email": "test@example.com", "identBirthday": null, "identVat": null, "identPassport": null, "identCompanyRegistration": null, "identIdentityCard": null, }, "errors": {} } ``` >Response `200` (validation error) ```json { "status": "error", "item": { "id": "150", "firstName": "", "lastName": "Priezvisko", "orgName": null, "street": "Stare Grunty 12", "city": "Kosice", "zip": "040 17", "country": "SK", "phone": "+421.900123456", "email": "test@example.com", "identBirthday": null, "identVat": null, "identPassport": null, "identCompanyRegistration": null, "identIdentityCard": null }, "errors": { "firstName": [ "First Name cannot be blank." ] } } ``` >Response `404` (not found) ```json { "message": "Domain profile not found.", "code": 404 } ``` Delete domain profile {#delete-domainProfile} ----------------------------------------- No parameters required. You cannot delete domain profile that is already assigned to a domain. >Curl ```sh curl "https://rest.websupport.sk/v1/user/:id/domainProfile/:domainProfileId" -X DELETE -u key:signature -H "Date: request_date_time" ``` >Request ```http DELETE https://rest.websupport.sk/v1/user/:id/domainProfile/:domainProfileId HTTP/1.1 Accept: application/json ``` >Response `200` >Response `400` ```json { "message": "Profile does not exist", "code": 400 } ``` >Response `400` ```json { "message": "Cannot delete profile with assigned domains!", "code": 400 } ``` --------------------------