samagra-comms / utils

0 stars 13 forks source link

Update the structure for API Response #6

Open ChakshuGautam opened 3 years ago

ChakshuGautam commented 3 years ago

The new structure is

{
    "id": "api.userSegment.get",
    "ver": "1.0",
    "ts": "2021-08-05T05:39:43.742Z",
    "params": {
        "resmsgid": "895a98f0-f5af-11eb-8ca8-85b1d40797df",
        "msgid": null,
        "status": "failed",
        "err": "UNAUTHORIZED_REQUEST",
        "errmsg": "The user is not the owner of the asset."
    },
    "responseCode": "CLIENT_ERROR",
    "result": {}
}

The previous structure was directly giving the result field.

This would require an update in the BotService parser. Also, all requests will result in an either a correct response or an error. That should additionally be handled using the 200 code and parsing the params