Skip to main content

Create a Country

Endpoint Overview​

This API endpoint provides a detailed overview of the endpoint responsible for creating a country within the Resources module of the Juleb ERP.

Endpoint Details​

  • Method: POST
  • URL: /api/v1/resources/res-country

Parameters​

  • Path Parameters: None
  • Query Parameters: None

Request Body​

{
"name": string,
"code": string,
"address_format": string,
"phone_code": integer,
"name_position": string,
"vat_label": string
}

Field Reference​

FieldTypeRequiredDescription
namestringYesCountry name.
codestringNoISO country code (2 characters).
address_formatstringNoAddress format template used when printing documents.
phone_codeintegerNoInternational dialing code.
name_positionstringNoName position format (e.g. for address layout).
vat_labelstringNoVAT label used for this country (e.g. "VAT", "TRN").

Response​

  • 201 OK: Successfully created the record.
  • 400 Bad Request: Bad request.
  • 401 Unauthorized: Unauthorized.

Response Body​

{
"data": {
...record fields
}
}

Example​

Request​

const axios = require('axios');
const accountName = process.env.ACCOUNT_NAME;
const apiKey = process.env.API_KEY;

axios.post(`https://${accountName}.juleb.com/api/v1/resources/res-country`, {
name: 'Saudi Arabia',
code: 'SA',
phone_code: 966,
vat_label: 'VAT'
}, {
headers: {
accept: '*/*',
Authorization: `TOKEN`,
'Content-Type': 'application/json'
}
})
.then(response => {
console.log(response.data);
})
.catch(error => {
console.error('Error:', error);
});

Response​

{
"data": {
"id": 193,
"name": "Saudi Arabia",
"code": "SA",
"phone_code": 966,
"vat_label": "VAT"
}
}