How to get modified records from the Schedules,Jobs,Quotes etc?

Wish the API had something it doesn't? Post here!
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.
jigar.s.golaniya
Posts: 35
Joined: Fri Jul 13, 2018 5:50 am

How to get modified records from the Schedules,Jobs,Quotes etc?

Post by jigar.s.golaniya » Wed Nov 21, 2018 3:54 am

Hi
On daily basis I want to retrieve all the new records inserted OR all the records that are modified into the Schedules,Jobs,Quotes etc.
I want to retrieve it on daily basis.

Thanks in Advance!
jigar
rick.lan
Posts: 274
Joined: Wed May 30, 2018 6:14 am

Re: How to get modified records from the Schedules,Jobs,Quotes etc?

Post by rick.lan » Wed Nov 21, 2018 4:36 am

Hi jiga,


Please look into If-Modified-Since Header usage:
http://developer.simprogroup.com/apidoc ... -resources

Please note that not all the endpoints/resouces support this header, we are adding them slowly.

cheers,

Rick
Rick Lan
API Developer | simPRO Software Group
jigar.s.golaniya
Posts: 35
Joined: Fri Jul 13, 2018 5:50 am

Re: How to get modified records from the Schedules,Jobs,Quotes etc?

Post by jigar.s.golaniya » Wed Nov 21, 2018 6:37 am

Hi Rick,
Thanks for your assistance!
I have gone through the RestAPI link that you have suggested but I could not get any information related to latest modified data, My rest call status is "200 OK" but still I could not get the exact information what I'm trying to get!

I have make the rest call through the following RestAPI
/api/v1.0/companies/123/jobs/ If-Modified-Since: Wed, 30 May 2018 12:00:00 GMT

Thanks,
jigar
rick.lan
Posts: 274
Joined: Wed May 30, 2018 6:14 am

Re: How to get modified records from the Schedules,Jobs,Quotes etc?

Post by rick.lan » Fri Nov 23, 2018 6:23 am

Hi jigar,

If-Modified-Since needs to put in the header:

https://developer.mozilla.org/en-US/doc ... fied-Since

cheers,

Rick
Rick Lan
API Developer | simPRO Software Group
Ashishs
Posts: 47
Joined: Tue Apr 16, 2019 11:14 pm

Re: How to get modified records from the Schedules,Jobs,Quotes etc?

Post by Ashishs » Tue Apr 28, 2020 3:26 am

Can you give an example of inserting If-Modified-Since header in the GET request in PHP using simPRO API ?
rick.lan
Posts: 274
Joined: Wed May 30, 2018 6:14 am

Re: How to get modified records from the Schedules,Jobs,Quotes etc?

Post by rick.lan » Tue Apr 28, 2020 5:23 am

Hi Ashishs,

It depends on the framework you use, if you use Curl library in PHP, then the syntax is:

Code: Select all

curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array("If-Modified-Since: ".gmdate('D, d M Y H:i:s \G\M\T',time())));
cheers,
Rick Lan
API Developer | simPRO Software Group
Ashishs
Posts: 47
Joined: Tue Apr 16, 2019 11:14 pm

Re: How to get modified records from the Schedules,Jobs,Quotes etc?

Post by Ashishs » Wed Apr 29, 2020 12:22 am

Hi Rick,

Thanks for the reply. I was hoping if you could provide with working example with a bit more detail.
Muqeet
Posts: 772
Joined: Mon Dec 03, 2018 3:24 am

Re: How to get modified records from the Schedules,Jobs,Quotes etc?

Post by Muqeet » Wed Apr 29, 2020 8:23 am

Hi Ashishs,

A brief working example using guzzle http might look like as follows.

Code: Select all

<?php

require 'vendor/autoload.php';

use \GuzzleHttp\Client;

$client = new Client([
    'base_uri' => '{simPRO-build-URL}
]);

$headers = [
    'Authorization'     => 'Bearer secure-access-token',
    'Accept'            => 'application/json',
    'If-Modified-Since' => 'Wed, 29 Apr 2020 01:10:00 GMT'
];

$response = $client->request(
    'GET',
    '/api/v1.0/companies/{companyID}/jobs/',
    [
        'headers' => $headers
    ]
);

print $response->getBody();
Muqeet
API Developer | simPRO Software Group
Ashishs
Posts: 47
Joined: Tue Apr 16, 2019 11:14 pm

Re: How to get modified records from the Schedules,Jobs,Quotes etc?

Post by Ashishs » Wed Apr 29, 2020 10:41 pm

Thanks Muqeet.

In my instance, I'm using something like:

Code: Select all

$provider = (new \simPRO\RestClient\OAuth2\APIKey())
    ->withBuildURL($buildURL)
    ->withToken($token)
;
I pass the $provider object around when I make the API call. e.g.

Code: Select all

$myArray = $provider->fetchJSON($provider->fetchRequest($URL));
Where would I insert the If-Modified-Since header in my example ?
Muqeet
Posts: 772
Joined: Mon Dec 03, 2018 3:24 am

Re: How to get modified records from the Schedules,Jobs,Quotes etc?

Post by Muqeet » Thu Apr 30, 2020 2:15 am

Hey Ashishs,

simPRO rest client is not actively maintained. The last update was made two years ago. It's just an example code repository to show how users can connect to simPRO rest API through different authorization types.

With that rest client you won't be able to send any headers to Provider object. If you really want to stick with the rest client you should look into the possibility of extending the Provider class to accept headers and pass it with $options array.
Muqeet
API Developer | simPRO Software Group
Post Reply