Discussions
Oauth2
Can someone please help me. I need just the oauth2 steps to add to the start of my excel power queries as now 2 factor has been implemented they no longer work with just basic private log in.
This below is what I have so far and it returns the jobs in the power query window but will not upload to worksheet as the down load has discontinued due to this error in the token response:
DataSource.Error: Web.Contents with the Content option is only supported when connecting anonymously.
Details: DataSourceKind=Web DataSourcePath=<https://api.servicem8.com/oauth/authorize>
And this error at end of query: 'We couldn't authenticate with the credentials provided. Please try again.'
Query:
let
// Get the API Token
api_url = "<https://api.servicem8.com/">,
token_path = "oauth/authorize",
ClientID = "588360",
Secret = "0874cda820434972bf572069342b53db",
```
EncodedCredentials = "Basic " & Binary.ToText(Text.ToBinary(ClientID & ":" & Secret), BinaryEncoding.Base64),
Token_Response = Json.Document(Web.Contents(api_url,
[
RelativePath = token_path,
Headers = [#"Content-Type"="application/x-www-form-urlencoded",#"Authorization"=EncodedCredentials],
Content=Text.ToBinary("grant_type=client_credentials")
]
)
),
// Get the token from the API response
token = Token_Response[access_token],
```
// Query the API for Transactions between startDate and endDate and return all fields
path = "api_1.0/job",
endDate = "2023-09-17 00:00:00",
startDate= "2023-09-11 23:59:59",
fields = "all",
```
data= Json.Document(Web.Contents("https://api.servicem8.com/api_1.0/job.json?%24filter=active%20eq%20%271%27")),
#"Converted to Table" = Table.FromList(data, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
#"Expanded Column1" = Table.ExpandRecordColumn(#"Converted to Table", "Column1", {"uuid", "date", "job_address", "work_done_description", "generated_job_id", "completion_date", "company_uuid", "payment_processed", "total_invoice_amount", "purchase_order_number", "status"}, {"Column1.uuid", "Column1.date", "Column1.job_address", "Column1.work_done_description", "Column1.generated_job_id", "Column1.completion_date", "Column1.company_uuid", "Column1.payment_processed", "Column1.total_invoice_amount", "Column1.purchase_order_number", "Column1.status"})
```
in
#"Expanded Column1"
Posted by Andrew Gould 3 days ago
Return Paramenters
In the response body where you create a job it returns an ok code.
It doesn't give the UUIUD or the Job number so we can't map it back to anything.
This is severely limited what am I missing when I create a new job how can I see what job number was allocated?
Posted by James Buchanan 5 days ago
Zapier Price
Hey,
At the moment we use zapier to create jobs in service m8 when they have been won by the sales team in another CRM. It creates a new quote and can add name,phone,email etc. but there is no option to move the price over.
Is there a way to make this possible?
Posted by Jeff 6 days ago
When using the api to add an attachment to a job it is marked as inactive and is not showing in the job
Even using the API reference to test is as show here has the same results
var options = new RestClientOptions("<https://api.servicem8.com/api_1.0/attachment.json")>;
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("accept", "application/json");
request.AddHeader("authorization", "Basic c2hhbmVAaWNhbnN5c3RlbXMuY28ubno6cHIxY2ViMDBr");
request.AddJsonBody("{\"active\":1,\"related_object\":\"Job\",\"related_object_uuid\":\"98e0214e-6061-4437-bfde-206884498f5b\",\"attachment_name\":\"TV Version.png\",\"file_type\":\".png\",\"attachment_source\":\"M:\\\\RFMS\\\\Swift\\\\\",\"uuid\":\"4429a30b-c2af-450c-983b-20688a951e4b\"}", false);
var response = await client.PostAsync(request);
Console.WriteLine("{0}", response.Content);
Posted by Shane Way 6 days ago
Webhooks
Using the API to intergrate a 3rd party schedule
Is it possible to have the option for the Job webhook to be fired on a Job Update or Job Change? Their Zapier app only fires on New Jobs for servicem8
Posted by Byron Sanders 7 days ago
Calling the job material list via API (Python/Zapier)
Hi there,
I have a zapier integration that is meant to be calling the job materials list from servicem8 when a job gets assigned to a specific que. I can trigger the action when the job lands in the que and pass it along to my python script which is meant to provide a line item array of all the materials filtered by the uuid of the job which triggered my zap.
I am able to return only the first entry in the material list. Any idea why the rest of the array is being truncated?
e.g my python script:
```
import requests
# 'jobuuid' is the field containing the UUID in the input_data
job_uuid = input_data['jobuuid']
url = f"https://api.servicem8.com/api_1.0/jobmaterial.json?%24filter=job_uuid eq {job_uuid}"
headers = {
"accept": "application/json",
"authorization": "Basic MYCREDENTIALS"
}
response = requests.get(url, headers=headers)
if response.status_code == 200:
materials_data = response.json()
# Return the materials_data to pass it to the next steps in Zap
return materials_data
else:
return {
"error": f"Request failed with status code: {response.status_code}"
}
```
This is my return:
```
uuid: ccec4318-0077-4082-a309-410abb46e9c5
tax_rate_uuid: da374289-575b-4e78-bb6a-1de9409945cb
quantity: 1.0000
name: Bunnings inv. 2016/90315302
price: 61.9800
active: 1
displayed_amount_is_tax_inclusive: 1
displayed_amount: 61.9800
edit_date: 2023-09-19 14:42:36
job_uuid: 5d88a6c0-05c7-434e-86ef-200d2f1ffd6b
material_uuid: 16434f99-94d1-408c-aadb-f7337fcddc3b
sort_order: 0
cost: 56.3455
displayed_cost: 61.9800
id: RqNp2R6aEc50ExK10lucvpcXishvE2A5
runtime_meta
memory_used_mb: 47
duration_ms: 710
logs
```
I was expecting a json array to be returned however I am only getting which ever material is at the top of the list.
Really hoping I can generate the full list, would have really useful stock reordering applications.
Thanks for any help!
Nate
Posted by Nate Kennedy 7 days ago
API fields - unsure which ones to use
Hello,
We are using API and are bit lost figuring out the exact API fields that are for jobs:
- duration
- booking date
- booking time
We went through here: <https://developer.servicem8.com>
But it is not very clear as the fields we have tried did not do us any good.
Thank you!
Posted by Charlie Krasl 7 days ago
Integrating Freshsales suite with Service M8
I'm trying to connect Freshsales suite with Service M8. Below is the action we’re looking to perform : Whenever a deal is created in Freshsales Suite a web hook is triggered to create a job in Service M8. I have generated the APP Id and App Secret , but I’m not sure where to provide the authentication details to connect the two applications .
Posted by Anisha 13 days ago
Job card emailing
Hi, I have a few issues I need sorted ASAP for a clean and scalable system.
1. On the job cards, bottom left where the job contacts are, I need to be able to easily add up to 5 tenants on top of the billing contact and property manager. This is because I send a form 9 Entry Notice to all tenants before I perform a smoke alarm appointment.
2. Now when I click to "Email" button on the same job card, It doesn't display all the contacts available. Only the billing contact and 1x Tenant. I need to be able to send one email thread to all the attached tenants. BONUS: currently its also super difficult to determine the difference between each contact title (billing contact, tenant, property manager). As it only displays their names and not a title next to it. So essentially, my employees have to guess who's, who when selecting the contacts for email. It would be great it there was either a title next to the contact or have them colour coded etc. (currently Im putting the title "Tenant" in the first name field and their full name in the second field. Not great as you can imagine).
I feel this would be way easier to explain via a video call or even a screen recording I can email through. This is a crucial part of my operations and I 100% need a solution. I've used ServiceM8 for many years and hope to continue. Please work with me to make this possible. Thanks legends!!
Posted by Shaun Ridley 14 days ago
Job Templates Upon Creation
We are pushing jobs into ServiceM8 through the API.
<https://developer.servicem8.com/reference/post-job-create>
Is there any chance to add Job templates to the API endpoint so we can pre determine the correct template to apply to a new job?
Posted by James Buchanan 15 days ago