NAV Navigation
PHP

Elma developers page

This is the Elma developer's page, when you will find all the needed information to developer against the API's we provide.

CRM API v1.0.0

Scroll down for code samples, example requests and responses. Select a language for code samples from the tabs above or the mobile navigation menu.

CRM API

Base URLs:

Authentication

Status

Everything about Status

Shows the status of the API

Code samples

 'application/json',
    'apikey' => 'API_KEY',
    
    );

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('GET','https://crm.api.sandbox.elma.care/status', array(
        'headers' => $headers,
        'json' => $request_body,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

GET /status

Example responses

200 Response

{
  "data": {
    "status": "ok"
  }
}

Responses

Status Meaning Description Schema
200 OK Valid response Inline
500 Internal Server Error General error Error500

Response Schema

Status Code 200

Name Type Required Restrictions Description
» data object false none none
»» status string false none none

ServiceTemplates

Everything about Service Templates

Returns the list of services templates resource

Code samples

 'application/json',
    'apikey' => 'API_KEY',
    
    );

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('GET','https://crm.api.sandbox.elma.care/service-templates', array(
        'headers' => $headers,
        'json' => $request_body,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

GET /service-templates

Parameters

Name In Type Required Description
page query integer false The page to retrieve
perPage query integer false The number of results per page
sortBy query object false The sort by column
filters query object false An array of model attributes and values to filter the results

Example responses

200 Response

{
  "data": [
    {
      "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
      "attributes": {
        "name": "Elma Full",
        "title": "Elma Full",
        "price": {
          "amount": 2093,
          "currency": "EUR",
          "formatted": "20.93 EUR"
        },
        "beneficiaries_modification_allowed": false,
        "max_beneficiaries": 1,
        "description": "My Awesome description",
        "copayment": {
          "free_use_times": 10
        }
      }
    }
  ],
  "pagination": {
    "total": 1322,
    "count": 22,
    "per_page": 10,
    "current_page": 1,
    "total_pages": 133
  }
}

Responses

Status Meaning Description Schema
200 OK Valid response Inline
500 Internal Server Error General error Error500

Response Schema

Status Code 200

Name Type Required Restrictions Description
» data [ServiceTemplate] false none none
»» id string true none The service template id
»» attributes object true none none
»»» name string true none The service template name
»»» title string true none The service template title
»»» price object true none none
»»»» amount number true none none
»»»» currency string true none none
»»»» formatted string true none none
»»» beneficiaries_modification_allowed boolean false none Allow change max beneficiaries
»»» max_beneficiaries integer false none The maximum number of beneficiaries
»»» description string false none The service description
»»» copayment object false none none
»»»» free_use_times number true none none
»»» pagination Pagination false none none
»»»» total integer false none none
»»»» count integer false none none
»»»» per_page integer false none none
»»»» current_page integer false none none
»»»» total_pages integer false none none

Retrieves the detail of a service template resource

Code samples

 'application/json',
    'apikey' => 'API_KEY',
    
    );

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('GET','https://crm.api.sandbox.elma.care/service-templates/{id}', array(
        'headers' => $headers,
        'json' => $request_body,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

GET /service-templates/{id}

Parameters

Name In Type Required Description
id path string(uuid) true The service template id

Example responses

200 Response

{
  "data": {
    "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "attributes": {
      "name": "Elma Full",
      "title": "Elma Full",
      "price": {
        "amount": 2093,
        "currency": "EUR",
        "formatted": "20.93 EUR"
      },
      "beneficiaries_modification_allowed": false,
      "max_beneficiaries": 1,
      "description": "My Awesome description",
      "copayment": {
        "free_use_times": 10
      }
    }
  }
}

Responses

Status Meaning Description Schema
200 OK Valid response Inline
404 Not Found Resource not found Error404
500 Internal Server Error General error Error500

Response Schema

Status Code 200

Name Type Required Restrictions Description
» data ServiceTemplate false none none
»» id string true none The service template id
»» attributes object true none none
»»» name string true none The service template name
»»» title string true none The service template title
»»» price object true none none
»»»» amount number true none none
»»»» currency string true none none
»»»» formatted string true none none
»»» beneficiaries_modification_allowed boolean false none Allow change max beneficiaries
»»» max_beneficiaries integer false none The maximum number of beneficiaries
»»» description string false none The service description
»»» copayment object false none none
»»»» free_use_times number true none none

Quotes

Everything about Quotes

Simulates quotes prices

Code samples

 'application/json',
    'Accept' => 'application/json',
    'apikey' => 'API_KEY',
    
    );

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('POST','https://crm.api.sandbox.elma.care/quotes/simulate', array(
        'headers' => $headers,
        'json' => $request_body,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

POST /quotes/simulate

Body parameter

{
  "data": {
    "attributes": {
      "postal_code": "08090",
      "beneficiaries": [
        23,
        42
      ]
    }
  }
}

Parameters

Name In Type Required Description
body body SimulateQuote true none

Example responses

200 Response

{
  "data": [
    {
      "service": {
        "id": "b7d6539a-e9db-11e9-81b4-2a2ae2dbcce4",
        "name": "My Awesome service"
      },
      "price": {
        "amount": 2093,
        "currency": "EUR",
        "formatted": "20.93 EUR"
      },
      "periodicity": {
        "amount": 1,
        "period": "MONTH"
      }
    }
  ]
}

Responses

Status Meaning Description Schema
200 OK Valid response SimulateQuoteResponse
400 Bad Request Invalid body request Error400
401 Unauthorized Unauthorized request None
500 Internal Server Error General error Error500

Schemas

ServiceTemplate

{
  "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "attributes": {
    "name": "Elma Full",
    "title": "Elma Full",
    "price": {
      "amount": 2093,
      "currency": "EUR",
      "formatted": "20.93 EUR"
    },
    "beneficiaries_modification_allowed": false,
    "max_beneficiaries": 1,
    "description": "My Awesome description",
    "copayment": {
      "free_use_times": 10
    }
  }
}

Properties

Name Type Required Restrictions Description
id string true none The service template id
attributes object true none none
» name string true none The service template name
» title string true none The service template title
» price object true none none
»» amount number true none none
»» currency string true none none
»» formatted string true none none
» beneficiaries_modification_allowed boolean false none Allow change max beneficiaries
» max_beneficiaries integer false none The maximum number of beneficiaries
» description string false none The service description
» copayment object false none none
»» free_use_times number true none none

SimulateQuote

{
  "data": {
    "attributes": {
      "postal_code": "08090",
      "beneficiaries": [
        23,
        42
      ]
    }
  }
}

Properties

Name Type Required Restrictions Description
data object true none none
» attributes object true none none
»» postal_code string true none The simulation postal code
»» beneficiaries [number] true none The simulation beneficiaries age

SimulateQuoteResponse

{
  "data": [
    {
      "service": {
        "id": "b7d6539a-e9db-11e9-81b4-2a2ae2dbcce4",
        "name": "My Awesome service"
      },
      "price": {
        "amount": 2093,
        "currency": "EUR",
        "formatted": "20.93 EUR"
      },
      "periodicity": {
        "amount": 1,
        "period": "MONTH"
      }
    }
  ]
}

Properties

Name Type Required Restrictions Description
data [object] true none none
» service object true none none
»» id string true none The service id
»» name string true none The service name
» price object true none none
»» amount number true none The price amount
»» currency string true none The price currency
»» formatted string false none The price formatted
» periodicity object true none none
»» amount integer true none none
»» period string true none none

IdentificationDocument

{
  "type": "NIF",
  "value": "12345678Z"
}

Properties

Name Type Required Restrictions Description
type string true none The identification document type
value string true none The identification document value

Address

{
  "postal_code": "08191",
  "street_type": "Plaza",
  "street": "Les Basses",
  "administrative_authorities": [
    {
      "id": "eb193f0e-d876-11e9-8a34-2a2ae2dbcce4",
      "attributes": {
        "name": "Barcelona",
        "slug": "barcelona",
        "latitude": 2.67146,
        "longitude": 41.36795
      }
    }
  ],
  "number": "42-bis",
  "floor": "4",
  "door": "B",
  "latitude": 2.1478,
  "longitude": 41.9875
}

Properties

Name Type Required Restrictions Description
postal_code string true none The address postal code
street_type string false none The street type name
street string false none The address street
administrative_authorities [object] false none The address administrative authorities
» id string true none The administrative authority id.
» attributes object false none none
»» name string true none The administrative authority name
»» slug string true none The administrative authority slug
»» latitude number true none The administrative authority latitude
»» longitude number true none The administrative authority longitude
» number string false none The address number
» floor string false none The address floor
» door string false none The address door
» latitude number false none The address latitude
» longitude number false none The address longitude

AddressFull

{
  "type": "Calle",
  "street": "Les Basses",
  "postal_code": "08191",
  "administrative_authorities": [
    {
      "id": "eb193f0e-d876-11e9-8a34-2a2ae2dbcce4",
      "attributes": {
        "name": "Barcelona",
        "slug": "barcelona",
        "latitude": 2.67146,
        "longitude": 41.36795
      }
    }
  ],
  "number": "42-bis",
  "floor": "4",
  "door": "B",
  "latitude": 2.1478,
  "longitude": 41.9875
}

Properties

Name Type Required Restrictions Description
type string true none The address type
street string true none The address street
postal_code string true none The address postal code
administrative_authorities [object] true none The address administrative authorities
» id string true none The administrative authority id.
» attributes object true none none
»» name string true none The administrative authority name
»» slug string true none The administrative authority slug
»» latitude number true none The administrative authority latitude
»» longitude number true none The administrative authority longitude
» number string false none The address number
» floor string false none The address floor
» door string false none The address door
» latitude number false none The address latitude
» longitude number false none The address longitude

Pagination

{
  "total": 1322,
  "count": 22,
  "per_page": 10,
  "current_page": 1,
  "total_pages": 133
}

Properties

Name Type Required Restrictions Description
total integer false none none
count integer false none none
per_page integer false none none
current_page integer false none none
total_pages integer false none none

Error

{
  "data": {
    "error": {
      "code": 400,
      "message": "The JSON you have provided in your request does not comply with the schema"
    }
  }
}

Properties

Name Type Required Restrictions Description
data object false none none
» error object true none none
»» code integer true none The error code
»» message string true none The error message

Error400

{
  "data": {
    "error": {
      "code": 400,
      "message": "The JSON you have provided in your request does not comply with the schema"
    }
  }
}

Properties

Name Type Required Restrictions Description
data object false none none
» error object true none none
»» code integer true none The error code
»» message string true none The error message

Error404

{
  "data": {
    "error": {
      "code": 404,
      "message": "The resource cannot be found"
    }
  }
}

Properties

Name Type Required Restrictions Description
data object false none none
» error object true none none
»» code integer true none The error code
»» message string true none The error message

Error500

{
  "data": {
    "error": {
      "code": 500,
      "message": "General error"
    }
  }
}

Properties

Name Type Required Restrictions Description
data object false none none
» error object true none none
»» code integer true none The error code
»» message string true none The error message
PHP