Step 1: Business Setup #
The business, or Entity as its referred to in the system is the person, partnership, company or whatever other form of organization for which the reports are perpared.
The Entity #
To create an Entity on the Microbooks platform you need its name and Reporting Currency. Specifying the Currency Code will create a Currency object and associate it with the Entity.
Request #
curl --location --request POST 'https://api.microbooks.io/books/v1/entity' \
--header "Authorization: Bearer <bearer_token>" \
--data-raw '{
"name": "Acme Inc",
"currency_code": "USD",
}'
import requests
url = "https://api.microbooks.io/books/v1/entity"
body = {"name": "Acme Inc", "currency_code": "USD"}
headers = {"Authorization": "Bearer <bearer_token>"}
response = requests.request("POST", url, headers=headers, json=body)
print(response.text)
var request = require('request');
var options = {
'method': 'POST',
'url': 'https://api.microbooks.io/books/v1/entity',
'headers': {'Authorization': 'Bearer <bearer_token>'},
'body': '{
"name": "Acme Inc",
"currency_code": "USD",
}'
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
$client = new Client();
$body = '{
"name": "Acme Inc",
"currency_code": "USD",
}';
$request = new Request('POST', 'https://api.microbooks.io/books/v1/entity',
[headers' => ['Authorization' => 'Bearer <bearer_token>']],
$body
);
$res = $client->sendAsync($request)->wait();
echo $res->getBody();
var client = new RestClient("https://api.microbooks.io/books/v1/entity");
client.Timeout = -1;
var request = new RestRequest(Method.POST);
var body = "{
\"name\": \"Acme Inc\",
\"currency_code\": \"USD\",
}";
request.AddParameter("text/plain", body, ParameterType.RequestBody);
request.AddHeader("Authorization", "Bearer " + <bearer_token>);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
Response #
{
"status":"success",
"message":"Entity: Acme Inc created successfully",
"resource": {
"name":"Acme Inc",
"locale":"en_GB",
"user_id":1,
"id":1,
"currency_id":1,
"current_reporting_period": {
"calendar_year":"2022",
"period_count":1,
"status":"OPEN",
"entity_id":1,
"id":1
},
"currency": {
"currency_code":"USD",
"name":"US Dollar",
"user_id":1,
"id":1
},
"reporting_periods":[]
}
}
For more details on the Entity endpoint check out the How To Guide page as well as the Postman API Reference.