Page 1 of 1

Incorrect results from API for contacts end point

Posted: Wed May 03, 2023 1:39 pm
by alphagareth
For the contacts end point I need to get a list of changes. I've tried to narrow down by DateModified but i get incorrect data.

We are on simpro cloud as its a private server.

I narrowed it down to an individual record to provide this example but this is happening for whatever i change against the contacts end point.

Example 1 (using DateModified=ge(2023-05-03))
If i call /contacts/8035?columns=ID,DateModified

then i get result:
{
"ID": 8035,
"DateModified": "2023-05-03T14:17:38+01:00"
}

so then if i call /contacts/8035?columns=ID,DateModified&DateModified=ge(2023-05-03) i should see that record...but i don't, i get 4 different records that have also been modified today...so i can't tell that this record has been modified!

I can use if-modified-since to get the data i need, but it does mean reworking my code which is running for multiple blocks which will be a pain if this is just a temporary bug that will be fixed, so my question is...is it broken or am i calling it wrong?

Re: Incorrect results from API for contacts end point

Posted: Wed May 03, 2023 11:45 pm
by Sindre
Hi alphagareth,
For your example, when you search with an ID you will return that ID anyway and it should not take into account the parameter "ge(2023-05-03)" you have added.

The query parameters are more for list view to filter what records are returned than looking at individual records.

So querying like this should give you a list of all records modified since 3rd May:

Code: Select all

api/v1.0/companies/0/contacts/?columns=ID,DateModified&DateModified=ge(2023-05-03)
If it is correct that you get more than one result when including the contact ID please send me a private message with your build details and a screen shot of your results and I will have a closer look as it should only return one record.

Please note that we recommend using the if-modified-since header for sorting data based on date modified.

Regards

Re: Incorrect results from API for contacts end point

Posted: Thu May 04, 2023 8:19 am
by alphagareth
Sorry, totally made a mistake in what i typed in for the call.

I did mean I was calling /contacts/?columns=ID,DateModified&DateModified=ge(2023-05-03)

and not /contacts/8035?columns=ID,DateModified&DateModified=ge(2023-05-03)

The data does not show correctly when doing that. I will PM you our build details and some further screenshots.