How to create a simple REST service in mirth connect - rest

I've just entered in mirth connect world,I need to know ,how to create a simple rest api service in mirth,generate a url, the vendor hits to send the data to our mirth api.

You can use HTTP Listener in Source tab (image below) and set up custom headers and authentication.

Related

Using a Web activity along with a linked service to call a rest api

I have to send data to a rest API via data factory.
I get batches of records from a database, send them in the body of the REST API call, which provides a response that informs the action performed on each record.
I created a linked service to the base API URL, and this linked service does the authentication to the API.
My question is how I use this linked service along with a web activity in a pipeline?
The web activity requires me to enter a full URL, which feels redundant as the base URL is already in the linked service.
The web activity does let me add multiple linked services but I'm unsure why it allows multiple linked services and how this is supposed to work.
I would appreciate expertise regarding how the web activity works with a linked service.
Thanks!

Transfer SCP Cloud User Information securely to ABAP

I have a UI5 Application hosted on SAP NEO which retrieves Data via an ABAP OData Service.
Users are maintained in SAP Cloud Identity and mapped with their Backenduser and the login is setup via Principal Propagation. This is all setup and works.
I got requested to change the Application to enable External Sales Representatives without SAP Backend Users to use the application.
The idea is to use one "technical user" with Basic Authentication instead of Principal Propagation.
My question is what would be the way to identify the original Cloud Username in ABAP(since there sy-uname would be a technical user).
Debugging in ABAP didn't reveal the original information and I am afraid the original User is not even passed to the Gateway
The SAP Cloud User API (https://help.sap.com/viewer/65de2977205c403bbc107264b8eccf4b/Cloud/en-US/1de599bf722446849d2b2e10132df42a.html) is not an option because the request could be manipulated in the browser
I heard of another option using a Java Servlet. But I am afraid that means we have to setup there the whole OData Service again and with every change in the Gateway we have to adjust the Java Servlet as well, or is there maybe a proxy.
If you are using Mobile Services of SAP Cloud Platform, you can activate a header with the username to be transferred to your ABAP system. It's called X-SMP-ENDUSERNAME.
Ref the documentation at https://help.sap.com/viewer/38dbd9fbb49240f3b4d954e92335e670/Cloud/en-US/defdadb71ee2476691d987689e3703a2.html
I assume you can get cloud user ID within your UI5 application and in case you access backend via Odata model you can use ODataModel.setHeaders function to provide your custom request headers which will be attached to every request sent to the backend. I would try to send cloud user id in some custom header value.
And on ABAP side you can use DP facade interface in service implementation to read custom headers:
lo_facade ?= /iwbep/if_mgw_conv_srv_runtime~get_dp_facade( ).
lt_client_headers = lo_facade->get_request_header( ).

Sending message with topic to Azure Service bus Queue via HTTP POST?

I was wondering if there is a good way to send a message with a topic to a service bus queue via HTTP Post in postman for example.
I red something about Sas-key encryption but, lets say I would like to expose the url to someone for them to send my service bus messages, how do I do that the simplest way for them so to speak?
I just want them to have a url not crating a program to generate w token for it..
I know the Service Bus has a URL linked to it but I cant seem to send anything to it...
Is this possible?
I just want them to have a url not crating a program to generate w token for it..
From the Azure Service Bus send message API, we could know that Authorization header is required. If want to let someone to use just with a url. In my opinion is that we need to implement it ourself.
We could develop a Rest API service then we could give a rest api url to somebody who want to use. We could get some demo code about how to create topic and send message from the azure document.

What's the REST way to verify an email?

When a user register to my web application I send an email to verify his inbox.
In the email there are a link to a resource like this:
GET /verify/{token}
Since the resource is being updated behind the scenes, doesn't it break the RESTful approach?
How can I do it in a RESTful manner?
What you are talking about is not REST. REST is for machine to machine communication and not for human to machine communication. You can develop a 1st party REST client, which sends the activation to the REST service.
You can use your verification URI in the browser to access the REST client:
# user follows a hyperlink in the browser manually
GET example.com/client/v1/verify/{token}
# asking the client to verify the token
and after that the REST client will get the hyperlink for verification from the REST service and send the POST to the service in the background.
# the REST client follows the hyperlinks given by the service automatically
# the REST client can run either on the HTTP client or server side
GET example.com/api/v1
# getting the starting page of the REST service
# getting the hyperlink for verification
POST example.com/api/v1/verification {token}
# following the verification hyperlink
If you have a server side 1st party REST client, then the HTTP requests to the REST service will run completely on the server and you won't see anything about it in the browser. If you have a client side REST client, then you can send the POST in the browser with AJAX CORS or you can try to POST directly with a HTML form (not recommended). Anyways the activation should be a POST or a PUT.
It depends on what are you trying to do.
Does it fire an email after validating the user for example? If so, it is not an idempotent method and you should use POST.
Example:
POST /users/{id}/verify/{token}
If the method doesn't have any consequence besides the update, I think you should use PUT.
Aren't you overthinking REST? With e-mail verification you want the user to be able to simply click the link from whatever mail user agent he is using, so you'll end up with a simple GET on the server (presented as a hyperlink to the user) with the token either in the path or as part of the query string:
GET http://example.com/verify-email/TOKEN
GET http://example.com/verify-email?token=TOKEN
Either is fine for this use case. It is not really a resource you are getting or creating; just a trigger for some process on the backend.
Why do you think this would run afoul of good design?

Mirth Connect integration with REST api

Is there a way to call REST api (or any other RPC) in Mirth connect.
Here is the scenario, I want to be able check validity of some filed, by calling a REST API with the value of a field in an incoming record, then decide how to route it, is this possible
In mirth destinations there are HTTP sender and Web service sender. you could use HTTP sender to call rest ful services