shareandcharge / sharecharge-api

HTTP webserver for the Share&Charge e-Mobility Network
0 stars 0 forks source link

tarifs json response is not parsable #3

Closed AndreiD closed 6 years ago

AndreiD commented 6 years ago

the current tariff json response is GET http://localhost:3000/api/store/tariffs/0x73d008c9d78109c95c54b936c56b3cdc7ca8252e

{
    "666": {
        "id": "666",
        "currency": "EUR",
        "elements": [
            {
                "priceComponents": {
                    "type": "FLAT",
                    "price": 1.2
                },
                "restrictions": {}
            }
        ],
        "last_updated": "2018-08-06T10:38:32.413Z"
    }
}

however I cannot parse it like this. since I don't know from the start the ID (?)

I think it should be something similar to this (transformed it into json array, and removed the id key)

[
      {
        "id": "666",
        "currency": "EUR",
        "elements": [
            {
                "priceComponents": {
                    "type": "FLAT",
                    "price": 1.2
                },
                "restrictions": {}
            }
        ],
        "last_updated": "2018-08-06T10:38:32.413Z"
    }
]
adamstaveley commented 6 years ago

I have added a url parameter:

GET http://localhost:3000/api/store/tariffs/0x73d008c9d78109c95c54b936c56b3cdc7ca8252e?raw=true

Will return the object as it is added in IPFS without any deserialization.

AndreiD commented 6 years ago

fixed now