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 (nl, fr, en)
firstname The first name of the user. (Optional) 30 characters
lastname The last name of the user. (Optional) 40 characters
privacyConsent Indicates whether the user has agreed to the privacy terms. Boolean (true/false)

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",
  "redirectUrl": "https://www.url.be?t=3f2504e0-4f89-11d3-9a0c-0305e82c3301",
  "accountUrl": "https://napi.pmg.be/api/login/auth/eyJ...D8l1Vlhg?redirecturl=https://account.pmg.be/nl"
}

status: HTTP status code indicating success (200)
token: The generated token for the user.
redirectUrl: Specifies the URL for redirect, including the token if available.
accountUrl: Provides the URL to delete the account, always with an access token.

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",
  "privacyConsent": true
}

Response:

{
  "status": 200,
  "token": "3f2504e0-4f89-11d3-9a0c-0305e82c3301",
  "redirectUrl": "https://www.dobbit.be/en/proximus?t=3f2504e0-4f89-11d3-9a0c-0305e82c3301",
  "accountUrl": "https://napi.pmg.be/api/login/auth/eyJ...D8l1Vlhg?redirecturl=https://account.pmg.be/nl"
}