NAV
shell

Introduction

Welcome to the HundrED API!

Authentication

Server expects for the JWT_TOKEN to be included in all API requests to the server in a header.

The header AUTHORIZATION should look like following:

Authorization: Bearer JWT_TOKEN

Payload should look like following:

{ "app_id": "APP_ID" }

{
  "app_id": "APP_ID"
}

The above JSON object is should be included in JWT payload.

 curl -i -H "AUTHORIZATION: Bearer JWT_TOKEN" https://hundred.org/api/innovations/15

The above command returns JSON structured like this:

{  
   "innovation":{  
      "slug":"third-innovation",
      "title":"Third innovation",
      "cover_image_url":"fallback/collection/default5.png",
      "date":"20.6.2019",
      "body":"<p><b>What we do?</b></p> <p></p> <p><b>Why we do it?</b></p> <p></p>"
   }
}

Innovations

Get all innovations

curl "https://hundred.org/api/innovations"
  -H "Authorization: Bearer JWT_TOKEN"

The above command returns JSON structured like this:

{  
   "innovations":[  
      {  
         "slug":"second-innovation",
         "title":"Second innovation",
         "cover_image_url":"fallback/collection/default0.png",
         "date":"22.5.2018"
      },
      {  
         "slug":"first-innovation",
         "title":"First innovation",
         "cover_image_url": URL_TO_IMAGE,
         "date":"7.3.2018"
      }
   ]
}

This endpoint retrieves all innovations.

The request is paginated. next page you can get by passing page parameter.

HTTP Request

GET https://hundred.org/api/innovations

Query Parameters

Parameter Default Description Options
order featured returns result ordered by any of the options latest, name, views
search empty returns found innovations list
page 1 Page of the response
limit 20 returns exact amount of innovations up to 20

Get a specific innovation

curl "GET https://hundred.org/api/innovations/third-innovation"
  -H "Authorization: Bearer JWT_TOKEN"

The above command returns JSON structured like this:

{  
   "innovation":{  
      "slug":"third-innovation",
      "title":"Third innovation",
      "cover_image_url":"fallback/collection/default5.png",
      "date":"20.6.2019",
      "body":"<p><b>What we do?</b></p> <p></p> <p><b>Why we do it?</b></p> <p></p>"
   }
}

This endpoint retrieves a specific innovation.

HTTP Request

GET https://hundred.org/api/innovations/<SLUG>

URL Parameters

Parameter Description
SLUG The SLUG of the innovation to retrieve

Survey

Add survey id (Webhook)

curl -X PUT -H "Authorization: Bearer SIGNED_JWT_TOKEN" -d "team_id=innovation-uid&user_id=user-uid&survey_id=survey-id" "https://hundred.org/api/innovations/survey" 

The above command returns JSON structured like this:

{  
"status": "updated"
}

This endpoint adds survey id to an innovation.

HTTP Request

PUT https://hundred.org/api/innovations/survey

URL Parameters

Parameter Format Description
team_id String Innovation uniq code
user_id String HundrED user uniq code
survey_id String Enjoy survey ID

Errors

The HundrED API uses the following error codes:

Error Code Meaning
400 Bad Request -- Your request is invalid.
401 Unauthorized -- Your API key is wrong.
403 Forbidden -- The innovation requested is hidden for administrators only.
404 Not Found -- The specified innovation could not be found.
405 Method Not Allowed -- You tried to access an innovation with an invalid method.
406 Not Acceptable -- You requested a format that isn't json.
410 Gone -- The innovation requested has been removed from our servers.
418 I'm a teapot.
429 Too Many Requests -- You're requesting too many innovations! Slow down!
500 Internal Server Error -- We had a problem with our server. Try again later.
503 Service Unavailable -- We're temporarily offline for maintenance. Please try again later.