Create an Account
The Create an Account method allows to add a new Account.
POST /api/vendor/v1/accounts.json?api_token={api_token}
Arguments
Name | Parameter Type | Data type | Required/Optional | Description |
---|---|---|---|---|
api_token | query | string | Required | API token of the manager who perform the operation (see API Token Authentication). |
account_type_id | form | integer | Required | An account type ID. |
primary_name | form | string | Optional | A company name, if the customer is a legal entity. |
first_name | form | string | Required | The first name for the user the owner access rights. |
middle_name | form | string | Optional | The middle name for the user the owner access rights. |
last_name | form | string | Required | The last name for the user the owner access rights. |
owner_id | form | integer | Optional | An ID of the existed user who will be granted the owner access rights in the Customer Control Panel. |
manager_id | form | integer | Optional | A manager ID who will be linked with the account. |
account_class_id | form | integer | Required | An account class ID (see Account classes in the ActivePlatform. Operator Control Panel). |
country | form | string | Required | An account address: a two-letter ISO code ISO 3166-1 alpha-2 of the country. |
region | form | string | Required | An account address: a region. |
city | form | string | Required | An account address: a city. |
street | form | string | Required | An account address: a street. |
building | form | string | Required | An account address: building. |
An account address: building.office | form | string | Required | An account address: office. |
zip | form | string | Required | An account address: a zip-code. |
phone | form | string | Required | A phone number of the account:
|
form | string | Required | A contact email of the account. | |
billing_day | form | integer | Optional | A day of the month when the invoices are created. |
custom_attributes[][key] | form | string | Depends on ID of the account type | A list of additional attributes (see Managing attributes in the ActivePlatform. Operator Control Panel). The key that is used to determine the element in API (see Creating an attribute in the ActivePlatform. Operator Control Panel). |
custom_attributes[][value] | form | Depends on attribute | Depends on ID of the account type | A value of the attribute. |
Response model
Name | Data type | Description |
---|---|---|
id | integer | An account ID. |
name | string | An account name. |
account_class_id | integer | An account class ID (see Account classes in the ActivePlatform. Operator Control Panel). |
account_class | string | A name of the account class (see Account classes in the ActivePlatform. Operator Control Panel). |
primary_name | string | A company name, if the customer is a legal entity. |
first_name | string | The first name for the user the owner access rights. |
middle_name | string | The middle name for the user the owner access rights. |
last_name | string | The last name for the user the owner access rights. |
country | string | An account address: a two-letter ISO code ISO 3166-1 alpha-2 of the country. |
region | string | An account address: a region. |
city | string | An account address: a city. |
street | string | An account address: a street. |
building | string | An account address: building. |
office | string | An account address: office. |
zip | string | An account address: a zip-code. |
phone | string | A phone number of the account:
|
string | A contact email of the account. | |
status | string | A current account status:
|
balance | float | A current value of the account balance (see Viewing the List of Charges in the ActivePlatform. Operator Control Panel). |
credit_limit | float | A maximum amount of the credit that a customer can use for ordering services without topping up (the credit limit can be set manually or by default (see Account classes in the ActivePlatform. Operator Control Panel)). |
account_type_id | integer | An ID of the account type. |
account_type | string | A name of the account type. |
manager_id | integer | A manager ID who is linked with the account. |
owner_id | integer | An ID of the existed user who is granted the owner access rights in the Customer Control Panel. |
tech_user_id | integer | An ID of the user, which is responsible for the technical matters. |
bill_user_id | integer | An ID of the user, which is responsible for the financial matters. |
custom_attributes | array | A list of additional attributes (see Managing attributes in the ActivePlatform. Operator Control Panel):
|
created_at | date | A date and time of the account's creation. |
updated_at | date | A date and time, when the account information was updated. |
Request example
http://billing.activeplatform.com:80/api/vendor/v1/accounts.json?api_token=654321
{
"account_type_id": 1,
"first_name": "John",
"last_name": "Doe",
"account_class_id": 1,
"country": "BY",
"region": "Minsk",
"city": "Minsk",
"street": "Lenina",
"building": "1",
"office": "1",
"zip": "220007",
"phone": "+375290745930",
"email": "doe.john777@activeplatform.com",
"custom_attributes": [
{
"key": "birth_date",
"value": "10.08.2016"
},
{
"key": "passport_date_of_issue",
"value": "01.07.2016"
},
{
"key": "passport_issued_by",
"value": "Goverment"
},
{
"key": "personal_number",
"value": "A4411111BB111"
},
{
"key": "passport_number",
"value": "1124111111111"
}
]
}
Response example
If the Account is successfully created, the method returns:
{
"id": 2000712,
"name": "John Doe",
"account_class_id": 1,
"account_class": "Default",
"primary_name": "",
"first_name": "John",
"middle_name": null,
"last_name": "Doe",
"country": "BY",
"region": "Minsk",
"city": "Minsk",
"street": "Lenina",
"building": "1",
"office": "1",
"zip": "220007",
"phone": "+375290745930",
"email": "doe.john777@activeplatform.com",
"status": "active",
"balance": 0,
"credit_limit": 100,
"account_type_id": 1,
"account_type": "Personal",
"manager_id": null,
"owner_id": 2021052,
"tech_user_id": 2021052,
"bill_user_id": 2021052,
"custom_attributes": [
{
"name": "Enable a new DNS",
"value": ""
},
{
"name": "Birth date",
"value": "10.08.2016"
},
{
"name": "Oasis Account ID",
"value": ""
},
{
"name": "Passport date of issue",
"value": "01.07.2016"
},
{
"name": "Passport issued by",
"value": "Goverment"
},
{
"name": "Passport number",
"value": "1124111111111"
},
{
"name": "Personal number",
"value": "A4411111BB111"
},
{
"name": "TenantID",
"value": ""
},
{
"name": "Tenant Name",
"value": ""
},
{
"name": "test_date_attr",
"value": ""
},
{
"name": "Trial",
"value": ""
}
],
"created_at": "2016-10-07T13:49:47.934+03:00",
"updated_at": "2016-10-07T13:49:47.934+03:00"
}
If the Account is not created, the method returns the mistake description:
{
"error": {
"location.country": [
"is not included in the list"
],
"location.phone": [
"is not in international format"
],
"custom_attributes.value": [
"can't be blank",
"is not included in the list"
],
"passport_date_of_issue": [
{
"value": [
"can't be blank",
"is not included in the list"
]
}
],
"personal_number": [
{
"value": [
"can't be blank"
]
}
],
"birth_date": [
{
"value": [
"can't be blank",
"is not included in the list"
]
}
],
"passport_number": [
{
"value": [
"can't be blank"
]
}
],
"passport_issued_by": [
{
"value": [
"can't be blank"
]
}
]
}
}