Discussions

Ask a Question

"Open API" specification files

Hi all, I'm trying to find out if there are "OPEN API" specification files for ServiceM8's APIs Does anyone know where I can get these? Many thanks Andre

Company end point race condition

It looks like if multiple create requests are made to the company create endpoint at the same time with the same name property set both can(incorrectly) succeed. There is a constraint on the ServiceM8 side that normally prevents this but I somehow have the same companies with exactly the same name created 1 second apart from each other. Subsequent requests to the update endpoint also fail until I delete one of the records.

Getting wrong scheduled datetime in Job data

We are using API url to fetch Jobs data. https://developer.servicem8.com/reference/get-job-all But we are getting different scheduled datetime('job_is_scheduled_until_stamp') in JSON response E.g. actual scheduled time is 1:00 PM with duration of 1 hour(While booking). We're getting 2:00 PM and if duration is 30 mins, we're getting 1:30 PM in API response. We want actual time without added duration. OR can we get separate duration time field in job data?

Problem with uploading a new Attachment to job via API

Hi, here is my code to upload attachment to my job. But this doesn't do anything. What is from in my request? const options = { method: 'POST', headers: { Accept: 'application/json', 'Content-Type': 'application/json', Authorization: 'Basic bWFyY2VsLmdvbG9iQHRlcm1vc2hvcC5zaTpQdXA4NjYxMQ==' }, body: JSON.stringify({ uuid: 'eae79142-af52-446c-b315-1e8eba13846b', related_object: 'job', related_object_uuid: 'eae79142-af52-446c-b315-1e8eba13846b', active: 1, attachment_name: 'nalog3.pdf', file_type: '.pdf', timestamp: '2022-06-07 00:00:00', attachment_source: 'nalog3.pdf' }) }; fetch('https://api.servicem8.com/api_1.0/attachment.json', options) .then(response => response.json()) .then(response => console.log(response)) .catch(err => console.error(err));

Bug: Job Materials being removed if two staff / or API and staff access the same Job.

Hi, We have found a bug in relation to job materials being marked as removed for jobs where more than one user/api is accessing, or has accessed the job. For example if a staff member has a job card open and is adding materials or updating the job notes etc, and the API inserts Job Materials in to the job. When the staff member clicks save, the Job Materials sent via API have their status changed to removed. To extend on this issue, I was able to repeat it within ServiceM8 itself. One browser is logged in via incognito, the other is not. If I impersonate one staff member and add materials to a job, and then another staff member does the same. The jobs are now loaded as is. If either of these staff members open that job card again without the need to refresh their browser, they don't see the materials the other staff member added, and so if they click save, then the materials added by the other is marked as removed. The same issue occurs if you are on the iOS app, and add a material item to the job, and someone on their desktop is adding a note or additional items to the job they had opened. I have recorded two videos to demonstrate the issues explained above, unfortunately no audio, however, I did write in the materials description or job notes what is taking place. https://drive.google.com/file/d/1HKVFWqlIciqvi4tn9P5KqWMWPYLNzJZd/view?usp=sharing https://drive.google.com/file/d/1OcaylOHM43yTVlC_d7pZh6Auv6FL6JgW/view?usp=sharing Please feel free to reach out for more information, if required.

Creating a new Attachment - API Error

When i trying to create Attachment: { errorCode: 400, message: 'object_name is not valid. Please supply a valid object_name.' } I need help to resolve this. Thanks.

Sending Booking Link via API

Hello I'm trying to see if it's possible to send the customer a job's Booking Link via the API. You can do this via the UI from inside the Schedule window in a job's card and it sends a SMS to the customer with a link for them to select their own schedule for the job. Is it possible to access this link/url via the API so we can automate this process? For example, as soon as an order comes in they receive this link to schedule that specific job. Thanks

ServiceM8 to Xero

When I try and send invoice from ServiceM8 to Xero it says It will not allow me and me and says you need to allocate the appropriate income account from your accounting package. No idea how to remedy this.

Getting "Authorization Required" everytime

Team, I want to register call back url for webhook to receive updated when client's data get change/updated on servicem8. Getting "Authorization Required" every time while subscribing for the webhook callback url. What i'm missing here.? can you give me step to do this? ******************************************************************** curl --location --request POST 'https://api.servicem8.com/webhook_subscriptions' \ --header 'Authorization: bearer [AccessToken]' \ --header 'Accept: application/json' \ --header 'Content-Type: application/x-www-form-urlencoded' \ --form 'object="Company"' \ --form 'fields="Active"' \ --form 'callback_url="[Webhook_Server_Callback_URL]"' ******************************************************************** OUT PUT : Authorization Required

Servicem8 Verify Webhook Callback URL

Hello Team, We are using below official document url of servicem8 to subscribe to the webhook. https://developer.servicem8.com/reference/post_webhook_subscriptions We found that, we have to Authenticate webhook callback url to receive post data using Oauth 2.0 process. We used this url : https://developer.servicem8.com/docs/authentication We did it and we are getting Access token using App Id and Client service Id but after that how to verify our server callback url to receive post data ? We are stuck here. Can you guide us or provide us with any reference url? While subscribing to the webhook callback url we are getting "Authorization Required" every time. Can you help what I'm missing here? Note : Below official servicem8 link to handle the verification step is not working https://developer-beta.servicem8.com/docs/overview So please provide the steps so we can move ahead. ***************************************************** MY PHP CURL CODE : ***************************************************** $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => 'https://api.servicem8.com/webhook_subscriptions', CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_POSTFIELDS => array('object' => 'Company','fields' => 'Active','callback_url' => 'https://safety.clouddownunder.com.au/public/admin/webhookcallback'), CURLOPT_HTTPHEADER => array( 'Authorization: bearer 68128-apse2-REMOVED', 'Accept: application/json', 'Content-Type: application/x-www-form-urlencoded' ), )); $response = curl_exec($curl); curl_close($curl); echo $response; ***************************************************** OUTPUT : Authorization Required *****************************************************