API Endpoint Documentation: GetToken

Description:

This API endpoint is used to generate a token for a user based on their email address and additional information. This token can be used for registration and access to the free content.

Endpoint:

POST https://webapi.pmg.be/v2/token/gettoken

Request Parameters:

Parameter Description Max Length
email The email address of the user for whom the token is being generated. 60 characters
originator A string indicating the originator of the request. 40 characters
languageCode A string representing the language code of the user. (Optional) 2 characters (e.g., nl, fr, en, de)
firstname The first name of the user. (Optional) 30 characters
lastname The last name of the user. (Optional) 40 characters

Response:

The response will be a JSON object containing a GUID token which is valid for 10 minutes.

Successful Response:

{
  "status": 200,
  "token": "3f2504e0-4f89-11d3-9a0c-0305e82c3301"
}

status: HTTP status code indicating success (200)
token: The generated token for the user.

Unsuccessful Response:

{
  "status": [error_code],
  "error": "[error_type]",
  "message": "[error_message]"
}

status: HTTP status code indicating the type of error.
error: Short description of the error.
message: Detailed error message.

Error Codes:

401: Unauthorized. Indicates that the request lacks proper authentication.
500: Internal Server Error. Indicates various error scenarios such as invalid email, invalid domain extension, invalid language code, invalid portal code, or registration failure.

Example Usage:

Request:

POST /GetToken HTTP/1.1
Host:  https://webapi.pmg.be/v2/token/gettoken
Authorization: Bearer [Your_Access_Token]
Content-Type: application/json

{
  "email": "user@example.com",
  "originator": "API",
  "firstname": "John",
  "lastname": "Doe",
  "languageCode": "nl"
}

Response:

{
  "status": 200,
  "token": "3f2504e0-4f89-11d3-9a0c-0305e82c3301"
}