PMA-2020 / pma-api

The best way to programmatically access PMA2020 data.
http://api.pma2020.org
MIT License
1 stars 3 forks source link

Instance endpoints: resultSize should always be 1, or left out #20

Open joeflack4 opened 6 years ago

joeflack4 commented 6 years ago

Description

When querying a specific instance, returned is an object with 3 keys: metadata, resultSize, and results. However when querying an instance, we only would expect a certain result. However, resultSize is equal to the number of keys in the single result object returned.

The better solution is to always set resultSize to 1 if not returning a list, or otherwise just leave it out of the response.

Example

http://api.pma2020.org/v1/texts/6EA0At85

{
  "metadata": {
    "datasetMetadata": [
      {
        "createdOn": "Fri, 13 Jul 2018 20:25:42 GMT", 
        "hash": "339ce036bdee399d449f95a1d4b3bb8f", 
        "name": "api_data-2018.03.19-v29-SAS", 
        "type": "api"
      }, 
      {
        "createdOn": "Fri, 13 Jul 2018 20:25:43 GMT", 
        "hash": "469542a93241da0af80269b6d7352600", 
        "name": "ui_data-2017.10.02-v4-jef", 
        "type": "ui"
      }
    ], 
    "version": "0.1.9"
  }, 
  "resultSize": 3,  <---------------------------------
  "results": {
    "id": "6EA0At85", 
    "langCode": "en", 
    "text": "Kinshasa Province"
  }
}