Discussions
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));
Posted by UPRAVA-Marcel Golob over 2 years ago
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.
Posted by Lance Solomon over 2 years ago
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.
Posted by UPRAVA-Marcel Golob over 2 years ago
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
Posted by Jean Pagan over 2 years ago
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.
Posted by James Scott over 2 years ago
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
Posted by Bipin over 2 years ago
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
*****************************************************
Posted by Bipin Patel over 2 years ago
Save SMS text contents in case of error
Hi,
While producing a quote for a job, a PDF document is produced and it is also added to the job log as "Client can view this quote online" this is a short url for example: https://sm8.link/xyz3aa3
Which API can retrieve this info? I have checked job, job notes, job attachments but no luck.
Posted by Farod James over 2 years ago
Feedback embed code is not working
Hi, the HTML code to embed feedback is not working on my Wordpress website. It only shows 'Feedback by ServiceM8'. Please could someone advise? I have copied and pasted the HTML from your website as advised directly.
Posted by Naomi Smith over 2 years ago
Create New Activty Endpoint
Is there a list available for what the field activity_was_scheduled can be set to. I'm wondering if it is possible to use this endpoint to create schedule a message to be sent to the customer.
Thanks,
Sinead
Posted by Sinead O Brien over 2 years ago