Discussions

Ask a Question
ANSWERED

Is it possible to create the client using api in servicem8?

Is it possible to create the client using api in servicem8?

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"

AddOn: Who is Current User?

I don't see anywhere who the user is connecting to my add-on. After the OAuth, I need to know the user making the request so that we can log this and provide functionality based on user's role.

Billing details on client record

Hi all, Could someone please advise how a clients billing details can be updated via the API? It seems that only billing_address is available, and I'm not able to set billing city/state/postcode. Thanks

Job for activity doesn't seem to exist in API

Hi, I am currently doing the following - 1. Sync all activities 2. Sync all jobs 3. Sync all job contacts 4. Build a model for each activity on the client by joining to the job via the job_uuid field on the activity and then to each job contact for that job. While I have been trying to do this I have found that the job_uuid reference in one of the activities does not seem to have a corresponding job record. I have also found querying the api directly for this job seems to return html that looks like this: https://api.servicem8.com/api_1.0/job/THE-JOB-UUID.json returns 200 OK + <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>200 OK</title> </head> <body> <h1>OK</h1> <p></p> <hr /> <address>ServiceM8/1.0</address> </body> </html> Is this an issue with the API or am I missing something?

Read inbox via API

Hi there, We want to read serviceM8 inbox via API. Can you please let me know the end point to read inbox via API. Also is there any webhook setup that will trigger when any email came in serviceM8 inbox? Thanks

API Error when updating specific jobs

We have noticed a new error occurring when we try to update certain Job Records in ServiceM8 via the API The error is ‘PUT on 'material' returned status 400. 400 Bad Request. Bad Request. Item Number must be unique. ServiceM8/1.0.’ But the error message is misleading. It only affects specific jobs. As well as updating the Quote with line items we also try to send PDFs to the job diary – this fails for these jobs as well with the error ‘No JSON object could be decoded’. But only for these jobs. All their other jobs work fine, as do all the other transactions we perform (hundreds a day) After a week or so, a couple of these jobs no longer had the problem and the failed transactions were able to be processed via the API without error. It seems to me that something in ServiceM8 is locking the specific Job record and not allowing us to update them. Can you offer any insight?

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.
ANSWERED

How to Revoke Connection using API

Hi, I have connected a application of service m8. How to Disconnect or Revoke Connection? Regards Akash

Can custom fields be used as the Job Number

Hi there I am helping a client integrate ServiceM8 with his existing business database. He wants to see the database job number instead of the sequential job number. Is this possible? TIA Paul