MENU navbar-image

Introduction

GreenIT 2025 Feedback API

Hi devs,

These are testing routes that work exactly like how they would in production, but they wont save anything to the database.

API Secret The route to get the token requires a secret to be set. This way we prevent any strangers from acquiring a token. The field to set is called api_secret, and can be seen in the example. The secret needs to be embedded in the React frontend as an environment variable.

The api_secret for the routes in this docs page is 12345, but is different for the production routes.

The routes behavior is the same between docs version and production version, though they point to different tables in the database. The docs table will be cleared each night.

Routes

The test responses in the docs table can be removed manually using the docs/response/remove route, This route is only available for the test database.

Test responseIds

Production routes for the frontend The production routes have the same naming logic, but note that the docs/ path segment should be removed. E.g. "https://api.green-it.nl/api/docs/response/hash" becomes: "https://api.green-it.nl/api/response/hash"

Cheers, Quinten

Authenticating requests

To authenticate requests, include an Authorization header with the value "Bearer {YOUR_AUTH_KEY}".

All authenticated endpoints are marked with a requires authentication badge in the documentation below.

You can retrieve your token by trying out the GET api/docs/token route below.

Endpoints

POST api/docs/token

Example request:
curl --request POST \
    "https://api.green-it.nl/api/docs/token" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"api_secret\": \"12345\"
}"
const url = new URL(
    "https://api.green-it.nl/api/docs/token"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "api_secret": "12345"
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Request      

POST api/docs/token

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

Body Parameters

api_secret   required  optional  

string Secret string to ensure only frontend can access these routes. Example: 12345

POST api/docs/response/hash

Example request:
curl --request POST \
    "https://api.green-it.nl/api/docs/response/hash" \
    --header "Authorization: Bearer 0|tokenincludingprecedingnumberandpipesymbol" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"responseId\": \"R_8OkTUcNei8V6fYb\"
}"
const url = new URL(
    "https://api.green-it.nl/api/docs/response/hash"
);

const headers = {
    "Authorization": "Bearer 0|tokenincludingprecedingnumberandpipesymbol",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "responseId": "R_8OkTUcNei8V6fYb"
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Request      

POST api/docs/response/hash

Headers

Authorization      

Example: Bearer 0|tokenincludingprecedingnumberandpipesymbol

Content-Type      

Example: application/json

Accept      

Example: application/json

Body Parameters

responseId   required  optional  

string The responseID of the participant in Qualtrics (to retrieve or also create the TestReportData in the test table). Example: R_8OkTUcNei8V6fYb

POST api/docs/response/data

Example request:
curl --request POST \
    "https://api.green-it.nl/api/docs/response/data" \
    --header "Authorization: Bearer 0|tokenincludingprecedingnumberandpipesymbol" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"hash\": \"itsjustabigrandomstring\"
}"
const url = new URL(
    "https://api.green-it.nl/api/docs/response/data"
);

const headers = {
    "Authorization": "Bearer 0|tokenincludingprecedingnumberandpipesymbol",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "hash": "itsjustabigrandomstring"
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Request      

POST api/docs/response/data

Headers

Authorization      

Example: Bearer 0|tokenincludingprecedingnumberandpipesymbol

Content-Type      

Example: application/json

Accept      

Example: application/json

Body Parameters

hash   required  optional  

string The hash of the participant's responseId. Example: itsjustabigrandomstring

POST api/docs/email

Example request:
curl --request POST \
    "https://api.green-it.nl/api/docs/email" \
    --header "Authorization: Bearer 0|tokenincludingprecedingnumberandpipesymbol" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"email\": \"youremailadress\",
    \"hash\": \"itsjustabigrandomstring\",
    \"preview\": \"1\"
}"
const url = new URL(
    "https://api.green-it.nl/api/docs/email"
);

const headers = {
    "Authorization": "Bearer 0|tokenincludingprecedingnumberandpipesymbol",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "email": "youremailadress",
    "hash": "itsjustabigrandomstring",
    "preview": "1"
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Request      

POST api/docs/email

Headers

Authorization      

Example: Bearer 0|tokenincludingprecedingnumberandpipesymbol

Content-Type      

Example: application/json

Accept      

Example: application/json

Body Parameters

email   required  optional  

string The participant's email. Example: youremailadress

hash   required  optional  

string The hash of the participant's responseId. Example: itsjustabigrandomstring

preview   required  optional  

boolean Shows email as json if true (1). If set to 0, tries to actually send email to given address. This field is omitted from the production route. Example: 1

POST api/docs/response/remove

Example request:
curl --request POST \
    "https://api.green-it.nl/api/docs/response/remove" \
    --header "Authorization: Bearer 0|tokenincludingprecedingnumberandpipesymbol" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"responseId\": \"R_8OkTUcNei8V6fYb\"
}"
const url = new URL(
    "https://api.green-it.nl/api/docs/response/remove"
);

const headers = {
    "Authorization": "Bearer 0|tokenincludingprecedingnumberandpipesymbol",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "responseId": "R_8OkTUcNei8V6fYb"
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Request      

POST api/docs/response/remove

Headers

Authorization      

Example: Bearer 0|tokenincludingprecedingnumberandpipesymbol

Content-Type      

Example: application/json

Accept      

Example: application/json

Body Parameters

responseId   required  optional  

string The responseID of the participant in Qualtrics (to remove this record from the table). Example: R_8OkTUcNei8V6fYb