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?
Incorrect results from API for contacts end point
Forum rules
- Check the documentation first. Before posting questions, please check the documentation to ensure it doesn't already cover what you need.
- No spam. All automated messages, advertisements, and links to competitor websites will be deleted immediately.
- Post in relevant sub-forums only. Messages posted in the wrong topic area will be removed and placed in the correct sub-forum by moderators.
- Respect other users. No flaming or abusing fellow forum members. Users who continue to post inflammatory, abusive comments will be deleted from the forum after two warnings are issued by moderators.
- Harassment. No threats or harassment of other users will be tolerated. Any instance of threatening or harassing behavior is grounds for deletion from the forums.
- Adult content. No profanity or pornography is allowed. Posts containing adult material will be deleted.
- Bandwidth. All images and signatures must be 500 x 500 pixels or smaller. Posts containing over-sized images and signatures will be removed.
- Illegal content. No re-posting of copyrighted materials or other illegal content is allowed. Any posts containing illegal content or copyrighted materials will be deleted.
- alphagareth
- Posts: 10
- Joined: Thu May 26, 2022 6:25 am
- Location: London
Re: Incorrect results from API for contacts end point
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:
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
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)Please note that we recommend using the if-modified-since header for sorting data based on date modified.
Regards
Sindre
API Developer | Simpro Software Group
API Developer | Simpro Software Group
- alphagareth
- Posts: 10
- Joined: Thu May 26, 2022 6:25 am
- Location: London
Re: Incorrect results from API for contacts end point
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.
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.
DEVELOPER CENTER