API interface

Introduction

CODE24 provides you with a professional integration via API interface, which enables the following web services:

  • Code check
  • Registration of a product
  • Change of customer data
  • Extension of a term

For this purpose, CODE24 offers its customers a REST interface that can be called via various requests. We offer the following requests for this purpose:

  • HTTP
  • cURL
  • PHP

This allows CODE24 to provide its customers with the user interface
for verification, registration, data modification, renewal completely by yourself and to integrate it optimally into the frontend of the website.

The WebService interface responds with a JSON object that can be automatically evaluated on the customer's side - for example, to provide feedback on validation errors.

General rules

The WebService API is called via the following URL. Please note the HTTPS protocol.
All parameters are passed via HTTP-POST.

https://code24.de

Web services

1. code check

You can check our key numbers directly online and immediately receive a message if the code is valid or not or if it is already registered.

POST /?keyfinder_check&json_response

Post fields (form-data)

  • code

    Requires. (String) - checks the code (example: A160045)

Query string parameters

  • keyfinder_check

    Requires. (String) - starts the action to check the code

  • json_response

    – Requires. (String) - sends JSON instead of HTML

Example call HTTP

POST /?keyfinder_check&json_response HTTP/1.1
Host: code24.de
Content-Type: application/x-www-form-urlencoded
Cache-Control: no-cache
code=A160045

Example call cURL

curl -X POST -F "code=A160045" "https://code24.de/?keyfinder_check&json_response"

Example call PHP

"https://code24.de/?keyfinder_check=&json_response=",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_TIMEOUT => 5,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => "code=A160045",
  CURLOPT_HTTPHEADER => array(
    "content-type: application/x-www-form-urlencoded",
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}

Example Result JSON Object

{
  "error": false,
  "success": true,
  "registered": false,
  "period": 0
}

Response scheme in case of success

  • success

    - (Boolean) - Indicates whether the check was successful (code exists or not).

  • registered

    - (Boolean) - Indicates whether the code has already been registered or not.

  • period

    - (Int) - specifies the period of the code

Failure response scheme

  • error

    - (Boolean) - return true if errors occur. Error message is provided with the following string and a user-friendly message:

    message

2. code registration

You can register the checked code directly online. For this purpose, appropriate parameters must be passed.

POST /?keyfinder_register&json_response

Post fields

  • keyfinder_register

    Requires. (String) - value is optional. Starts the registration session.

  • code

    Requires. (String) - The code to be registered (Example:

    A160045

    )

  • street

    Requires. (String) - Customer address Street and House number

  • zip

    Requires. (String) - customer address ZIP code

  • city

    Requires. (String) - customer address city

  • country

    Requires. (String) - Customer address country

  • email

    Requires. (String) - Customer address e-mail

  • salutation

    Requires. (String) - Customer address Salutation

  • firstname

    Requires. (String) - Customer address First name

  • loadname

    Requires. (String) - customer address last name

  • phone

    Requires. (String) - Customer address Phone

  • period

    Requires. (Int) - Customer address Term (Automatically assigned by the server, default 1 year)

Query string parameters

  • keyfinder_register

    Requires. (String) - starts the action to register the code

  • json_response

    - Benforced. (String) - sends JSON instead of HTML

Example call HTTP

POST /?keyfinder_register&json_response HTTP/1.1
Host: code24.de
Cache-Control: no-cache
Content-Type: application/x-www-form-urlencoded

keyfinder_register=1&code=A160045&city=Mannheim&country=DE&email=gw%40millenium.de&firstname=Max&lastname=Mustermann&period=1&phone=062112855440&salutation=Herr&street=Hafenstr.+86&zip=68159

Example call cURL

curl -X POST -H "Content-Type: application/x-www-form-urlencoded" -d 'keyfinder_register=1&code=A160045&city=Mannheim&country=DE&email=gw@millenium.de&firstname=Max&lastname=Mustermann&period=1&phone=062112855440&salutation=Herr&street=Hafenstr. 86&zip=68159' "https://code24.de/?keyfinder_register=&json_response="

Example call PHP

<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://code24.de/?keyfinder_register=&json_response=",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_TIMEOUT => 10,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => "keyfinder_register=1&code=A160045&city=Mannheim&country=DE&email=gw%40millenium.de&firstname=Max&lastname=Mustermann&period=1&phone=062112855440&salutation=Herr&street=Hafenstr.%2086&zip=68159",
  CURLOPT_HTTPHEADER => array(
    "content-type: application/x-www-form-urlencoded"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}

Example Result JSON Object

On success: HTTP 200 OK

{
  "error": false,
  "message": "Has been successfully registered."
}

On error: HTTP 500 Internal Server Error

{
    "error": true,
    "message": "Error! This code was not found or has already been regstated.<br>Please check your entries and try again if necessary. [ERR_CODE_REGISTERED_OR_NOT_FOUND]"
}

Response scheme in case of success

  • error

    - (Boolean) - Indicates whether the registration was successful.

  • message

    - (Boolean) - Outputs a user-friendly message

Failure response scheme

  • error

    - (Boolean) - return true if errors occur. Error message is provided with the following string and a user-friendly message:

    message

Error codes:

Missing value "code":

Error during data transmission! Please try again shortly. [ERR_EMPTY_CODE]

Missing mandatory fields

Error during data transmission! The following fields are missing:  [ERR_MISSING_FIELDS]

Mandatory fields are empty

Error during data transmission! The following fields are empty:  [ERR_EMTPY_FIELDS]

The code is already used or was not found

Error! This code was not found or has already been regstated.
Please check your input and try again if necessary. [ERR_CODE_REGISTERED_OR_NOT_FOUND]

Internal server error in the database

Error during data transmission! Please try again shortly. [ERR_UPDATE_FAILED]

Support

To ensure that you can use the interfaces without any problems, our competent and friendly support is at your disposal.

millenium advertising agency GmbH
Visual communication agency
Harbour road 86
68159 Mannheim

E-mail: info@millenium.de

Suggest Edit