How to create API endpoints without coding

Thanks, everything working now, my bad sending wrong http method!!

Hi, is there a way to return a response immediately and continue a long time job in background ?

What would be the result of that long time job?

The Job produces some files and then sends a teams and email notification on his completion. I need only an http 200 result response.

That looks very much like a webhook. Here is how you can handle webhooks in EasyMorph.

Method 1: Use the task reload webhooks.

A Server task (in the "Tasks" tab) can have a unique URL for triggering a task reload upon a GET request to that URL. The URL is disabled by default and should be enabled in the task settings.

The reload URL can have URL parameters to assign task parameters.

Method 2: Use the EasyMorph Gateway

The EasyMorph Gateway is an optional separately billed service to handle more sophisticated scenarios, where a webhook is sent from a cloud application, or when a webhook is sent using POST or another method with a request body (payload).

For more details, read: How to configure a connection to EasyMorph Gateway

Method 3: Use a custom job queue

Use a custom API endpoint to receive a request and put it into a job queue (the queue can be a database table, or a dataset, or a file, or Shared memory) and quickly return HTTP 200 OK. The queue can contain, for instance, a list of file paths to process. Every new request appends a new line to the job queue.

Schedule a Server task to check the job queue, pick a job from it, and process it asynchronously. Handling a custom job queue can be a non-trivial task because you would have to ensure that the same job isn't processed twice or remains in the queue if the task fails.

See also

Also, you could move long-running processes into one or more EasyMorph tasks. In the API endpoint project, parse and validate the incoming request and then call the EasyMorph task in the fire-and-forget mode.
Remember to set the Simultaneous runs to Unlimited and enable the Retry task on failure.
However, using the EasyMorph Webhook gateway or a separate queue will be more robust.


2 Likes

Thanks a lot, it’s the solution i looking for.

I want to call the API from an external
Cloud based application that supports web request. Has anyone achieved this? Any idea on how to do it? I appreciate there are security concerns also so any advice would be appreciated.

You can create a VPN or HTTP tunnel to your EasyMorph Server but that requires good network security skills.

Instead, consider making the cloud application send a cloud webhook through EasyMorph Gateway that will trigger a Server task that will push the necessary data into the cloud application. So it's a "push" integration schema rather than "pull".

1 Like