1
0
-1

When I call v2 API with the action addPictureUrl with three images, I get three recordMessages in the result set. There is nothing to differentiate between the three IDs that are returned. JSON does not guarantee order, so I can't simply rely on the order of the images in the recordMessages array. 

In my example, all of the pictures are associated with a single animal; however, since I'm providing the animalID for each pictureUrl, this could be three different animals - which would further complicate the mapping of returned images to animals (and the picture order on the animal).

It seems that, if I care about this mapping, I need to limit the addition of pictures to one per API call.

Here's the API call:

{
    "token":"{{token}}",
    "tokenHash":"{{tokenHash}}",
    "objectType":"animals",
    "objectAction":"addPictureUrl",
    "values":
    [
        {
            "animalID":"{{animalID}}",
            "pictureUrl":"https://via.placeholder.com/150"
        },
        {
            "animalID":"{{animalID}}",
            "pictureUrl":"https://via.placeholder.com/200"
        },
        {
            "animalID":"{{animalID}}",
            "pictureUrl":"https://via.placeholder.com/250"
        }
    ]
}

and the result:

{
    "status": "ok",
    "messages": {
        "generalMessages": [],
        "recordMessages": [
            {
                "status": "ok",
                "ID": 81778946,
                "messageID": "1003",
                "messageCriticality": "info",
                "messageText": "Successfully saved the record."
            },
            {
                "status": "ok",
                "ID": 81778947,
                "messageID": "1003",
                "messageCriticality": "info",
                "messageText": "Successfully saved the record."
            },
            {
                "status": "ok",
                "ID": 81778948,
                "messageID": "1003",
                "messageCriticality": "info",
                "messageText": "Successfully saved the record."
            }
        ]
    },
    "foundRows": 0,
    "data": []
}
    CommentAdd your comment...