Creating organization
Example of json data for HTTP request:
{
"name":"My Organization",
"address":"Lenina 40",
"country":"Russia",
"city":"Tomsk",
"phone":"+7-3822-123-456",
"zip":"634000"
}
Example of HTTP request:
curl -X POST https://api.msndr.net/v1/email/organizations \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer $API_TOKEN' \
-d '...JSON...'
POST and link /email/organizations method is used
Example of a response to a successful request:
{
"id":1,
"name":"My Organization",
"address":"Lenina 40",
"country":"Russia",
"city":"Tomsk",
"phone":"+7-3822-123-456",
"zip":"634000",
"current":true
}
An explanation of the json data parameters for the request is given in the table below:
Parameter |
Description |
Required |
name |
organization name |
yes |
address |
organization adress |
yes |
country |
country where the organization is based |
yes |
city |
city where the organization is based |
yes |
phone |
organization's phone number |
yes |
zip |
postal code |
yes |
Explanation of the json response parameters from the server is given in the table below:
Attribute Description
id organization id
name organization name
address organization adress
country country of the organization
city city of the organization
phone organization's phone number
zip organization's postal code
current is the default organization
9.1 Retrieving a list of organization using HTTP request:
Example of an HTTP request:
curl -X GET https://api.msndr.net/v1/email/organizations \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer $API_TOKEN'
The GET and link /email/organizations method is used
Example of a response to a successful request:
{
"total_count":1,
"total_pages":1,
"page_number":1,
"page_size":25,
"collection":[
{
"id":1,
"name":"My Organization",
"address":"Lenina 40",
"country":"Russia",
"city":"Tomsk",
"phone":"+7-3822-123-456",
"zip":"634000",
"current":true
}
]
}
An explanation of the parameters of the elements of the organisation array (collection) of the server's json response is given in the table below:
Attribute |
Description |
id |
organization id |
name |
organization name |
address |
organization adress |
country |
country of the organization |
city |
city of the organization |
phone |
phone number of the organization |
zip |
postal code of the organization |
current |
is the default organization |
Receiving information on the organisation
Example of HTTP request:
curl -X GET https://api.msndr.net/v1/email/organizations/1 \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer $API_TOKEN'
The GET and link /email/organizations/:id method is used
id is an organization's id
Example of a response to a successful request
{
"id":1,
"name":"My Organization",
"address":"Lenina 40",
"country":"Russia",
"city":"Tomsk",
"phone":"+7-3822-123-456",
"zip":"634000",
"current":true
}
Explanation of the parameters in the json response of the server is given in the table below:
Attribute Description
id organization id
name organization name
address organization adress
country country of the organization
city city of the organization
phone phone number of the organization
zip postal code of the organization
current is the default organization
Retrieving the default organization
HTTP request example:
curl -X GET https://api.msndr.net/v1/email/organizations/current \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer $API_TOKEN'
Uses GET method and /email/organizations/current endpoint
Successful response
{
"id":1,
"name":"My Organization",
"address":"Lenina 40",
"country":"Russia",
"city":"Tomsk",
"phone":"+7-3822-123-456",
"zip":"634000",
"current":true
}
Retrieving the default organization
HTTP request example:
curl -X GET https://api.msndr.net/v1/email/organizations/current \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer $API_TOKEN'
Uses GET method and /email/organizations/current endpoint
Successful response
{
"id":1,
"name":"My Organization",
"address":"Lenina 40",
"country":"Russia",
"city":"Tomsk",
"phone":"+7-3822-123-456",
"zip":"634000",
"current":true
}
Server response json parameters:
Attribute |
Description |
id |
organization id |
name |
organization name |
address |
organization adress |
country |
country of the organization |
city |
city of the organization |
phone |
phone number of the organization |
zip |
postal code of the organization |
current |
is the default organization |
Setting the organization as the default organization
HTTP request example:
curl -X PATCH https://api.msndr.net/v1/email/organizations/1/current \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer $API_TOKEN'
Uses PATCH method and /email/organizations/:id/current endpoint
id is the organization's id.
Successful response
{
"id":1,
"name":"My Organization",
"address":"Lenina 40",
"country":"Russia",
"city":"Tomsk",
"phone":"+7-3822-123-456",
"zip":"634000",
"current":true
}
json data parameters:
Attribute organization id
id organization id
name organization name
address organization adress
country country of the organization
city city of the organization
phone phone number of the organization
zip postal code of the organization
current is the default organization
Attribute | organization id |
id | organization id |
name | organization name |
address | organization address |
country | organization country |
city | organization city |
phone | organization phone number |
zip | organization postal code |
current | is the default organization |
Changing organization's parameters
Example of json data for HTTP request:
{
"name":"My Organization",
"address":"Lenina 40",
"country":"Russia",
"city":"Tomsk",
"phone":"+7-3822-123-456",
"zip":"634000"
}
Example of HTTP request:
curl -X PATCH https://api.msndr.net/v1/email/organizations/1 \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer $API_TOKEN' \
-d '...JSON...'
uses PATCH method and /email/organizations/:id endpoint
id is an organization's identifier
Successful response
{
"id":1,
"name":"My Organization",
"address":"Lenina 40",
"country":"Russia",
"city":"Tomsk",
"phone":"+7-3822-123-456",
"zip":"634000",
"current":true
}
The parameters of json data in HTTP request
Parameter |
Description |
name |
organization name |
address |
organization adress |
country |
organization country |
city |
organization city |
phone |
organization phone number |
zip |
organization postal code |
json response parameters from the server:
Attribute description
id organization id
name organization name
address organization adress
country country of the organization
city city of the organization
phone phone number of the organization
zip postal code of the organization
current is the default organization
Deleting organization
Example of HTTP request:
curl -X DELETE https://api.msndr.net/v1/email/organizations/1 \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer $API_TOKEN'
The DELETE and lonk /email/organizations/:id method is used
id is an organization's identifier