Discussions

Ask a Question

Issue uploading File via API

Hi, we are pushing files to ServiceM8 jobs via the API. We have been doing it in the past without issue, but in the past few days, we've had a bunch of 400 responses from the ServiceM8 API saying that every file upload needs a timestamp. Was this change at any point recently? We haven't changed our system in the last 3 months and the images have been uploading fine until now. I can't find any notifications of changes happening to the API. Thanks.

ServiceM8 Online Enquiry Add On

Hi, I am wanting to investigate a solution for my client. They are currently using the ServiceM8 Online Enquiry Add On and would like the customer to receive an email response that essentially says "Thanks we will be in contact. Here's what you wrote" sort of thing. Is there currently an ability in this add on for me to configure a webhook? or is it something I will need to look at developing an Add On for them Thanks and have a great day

Receiving 400 error when posting file attachment data

I'm able to create the file attachment and get a UUID back correctly. When I do the next call to upload the PDF binary data, I get an error back, 400 - No data received in POST. I've got the file type set as .pdf in the first call and I can see that data is present in the body of the outgoing call so I'm not sure what is happening. I've tried fiddling a bunch of settings but it's a consistent error coming back. Thanks, Alan

API end point stopped working

Job/Clent API end points stopped working. The error says the following: DataFormat.Error: We found extra characters at the end of JSON input. Details: Value= Position=181461 I already had this type of error before and it seems to clear on the following day without me doing anything. Are there times when API's do not work due to maintenance or something like that? Thanks

ASSET API

Any idea when the Assets from 7.0 will be available for API access?

Why do Contacts remain active when linked Company has been deleted?

I just had a look at the list of Contacts stored under my development account. There are many (more than a dozen) Contacts listed, with active = 1 and is_primary_contact = 1. These contacts previously belonged to Clients which were deleted more than a week ago. I expected the deletion of the Company to cascade delete the related Contact. Is this as-designed and as-documented? It would be nice to be able to see some kind of audit trail on the data save/edit/delete sequences.

API / System integration

Hi, I am working with one of your existing customers who has asked me to contact you on their behalf. Our HR system which your customer is using would like to be able to input your systems clocking in/out etc into ours via an API or a push mechanism if you have one. I hope that you are able to assist me in some way. I look forward to hearing from you.

Is it possible to create private addon?

Hi All, Can someone please advice on the below : 1. Can we create an addon which is just available for private usage (I don't want to open up the addon for public usage as its a very specific use case). Is this possible? 2. There are few addon's like Staff leave which captures the leave data for the each staff member. Is it possible to fetch this leave data via API? thanks

Self Hosted Add-On - returned Callback Html not displaying

Hi there ServiceM8 Team, I'm working on a self-hosted Add-On and am currently experimenting with different implementations. I was able to successfully play around with a "simple function" Add-On from your examples but decided on taking the self-hosted Add-On route. So far I've been able to successfully Activate the Add-On, I've implemented OAuth, the process goes as expected and my Add-On button appears in the job. I've created a "dummy" callback method that returns some basic html for testing purposes(the html itself doesn't seem to be the issue), it is successfully being called when the Add-On is clicked, and having tested with Postman I can see that the html content it's returning is correctly and displaying in Postman, however it does not display inside the Add-On modal. I have also tried with the "new window" approach and the result is the same. This is my Callback code implement in .NET Core [HttpPost] [Route("callback")] public async Task<ActionResult> Callback() { var request = HttpContext.Request; var requestBody = await new StreamReader(request.Body).ReadToEndAsync(); var tokenHandler = new JwtSecurityTokenHandler(); var validationParameters = new TokenValidationParameters { ValidateIssuerSigningKey = true, IssuerSigningKey = new SymmetricSecurityKey(Encoding.ASCII.GetBytes(_apiOptions.ClientSecret)), ValidateIssuer = false, ValidateAudience = false, RequireExpirationTime = false }; SecurityToken validatedToken; ClaimsPrincipal claimsPrincipal; try { claimsPrincipal = tokenHandler.ValidateToken(requestBody, validationParameters, out validatedToken); } catch (Exception ex) { Console.WriteLine($"Failed to validate JWT: {ex.Message}"); return BadRequest("Invalid JWT"); } var claims = claimsPrincipal.Claims.ToList(); var eventDataJson = (string)claims.First(claim => claim.Type == "eventArgs").Value; var eventName = (string)claims.First(claim => claim.Type == "eventName").Value; Console.WriteLine($"Event Name: {eventName}"); var html = $@"<html> <head> <script src=""https://platform.servicem8.com/sdk/1.0/sdk.js""></script> <link rel=""stylesheet"" href=""https://platform.servicem8.com/sdk/1.0/sdk.css""> <script type=""text/javascript""> var client = SMClient.init(); </script> </head> <body> <h1>Job Details</h1> <a href=""https://www.google.com"" class=""btn btn-primary"" target=""_blank"">Go to Google</a> </body> </html>"; return Content(html, "text/html"); I've tried playing around with the X-Frame-Options header settings with no success. So far I haven't been able to find an answer in the documentation and I've appreciate any help I could get - please let me know if I'm missing something. The endpoint handling these requests is doing it over https. Thank you, Antonio Batinic

Can we get Client Sites data via the API?

Hi, just wondering if we can query the Client Sites data via API GET request? I wasn't able to immediately able to find the answer in the developer section. Client Sites is an add-on: https://support.servicem8.com/hc/en-us/articles/202023544-Client-Sites-Overview Any help much appreciated, cheers.