API Interfacing – LDAP Directory Verification

API Interfacing – LDAP Directory Verification

Presentation 

In order to verify the existence of a user, we can interface with an API that informs us on the validity of the given email address. To do so, we interrogate a web service HTTP(S) in POST with a “X-Token” header, to only authorise our service to interrogate your API and two parameters “mail” and “resource_id” in the body of the request containing the email address to verify. The web service answers in JSON with a boolean (true/false) “user_valid”.

Process

In summary, here is the step-by-step process:
  1. A user makes a reservation on the website or the mobile app.
  2. We build a request to verify the given email address:
    1. Protocol: HTTP or HTTPS
    2. URL: URL that you communicate us
    3. Header :X-Token: Token to generate
    4. Body:
  1. {
  2. "mail" : "user@mail.com",
  3. “resource_id” : 123
  4. }

Example of curl request

  1. curl -X POST \
  2.   https://validation-url.com/ \
  3.   -H "Accept: application/json" \
  4.   -H "Content-Type: application/json" \
  5.   -H "X-Token: random-token" \
  6.   -d '{
  7.     "mail" : "utilisateur@etablissement.com",
  8.     “resource_id” : 123
  9.   }'

Response

Depending on the result (existing email adress, valid user, ...), the web service will send back a response:

  • If the user is valid: {"user_valid":true}
  1. {
  2. “user_valid” : true
  3. }
  • Is the user is not valid:
  1. {
  2. “user_valid” : false
  3. }