Custom Endpoints and Responses

I am new to the FM DATA API and have a couple of questions:

  1. My client is requesting a specific endpoint, "/InspectionRequest" where they feed us data to create a new inspection record. The FM Data API calls for the endpoint to be "/records" for a CREATE request. Is it possible to use a custom endpoint like that?

  2. We need to respond to the client with a custom response upon record creation beyond just the default recordID, namely a claim number they provided and our new inspection reference number for the record created. Can we do that?

We are currently on FM Server 17.
Thanks.

For number 1, you could do something like this with Claris Connect or other things that let you do webhooks.

Number 2 should also be possible with Claris Connect, but things can get tricky. If your process is lengthy, the call cannot wait forever for the return.

I'm curious to see what others will say on this.

more info...
the client can only POST, so I cannot steer them to a GET run script call.
the client's data is not wrapped inside a {"fieldData": } wrapper, so I cant directly use a create record call either.

I am downloading Claris Connect trial...

You should look into using a custom proxy/middleman service. By using something like ExpressJS or even just using AWS Lambda + APIGateway, you can customize your endpoints to work however you need.

It's generally best to not run other apps/services on your FMS box, but if push comes to shove, you can run your Express app on your FMS. If you do that, look into using something like PM2 to ensure the process is always running.

2 Likes

Why do they have these restrictions in place?

@jwilling suggested a middleman. That would allow you to meet the exact requirements of your client and translate them for FMS.

2 Likes