Skip to Content

Send and Receive Test SAP Event Mesh

Requires Customer/Partner License
Test send and receive of message with REST protocol using the Postman tool for a SAP Event Mesh instance.
You will learn
  • Send and Receive message to and from a queue using Postman, a REST-based tool
  • IMPORTANT: It is really important to understand the concept of Service Key of an SAP Event Mesh instance. Check out Step 2 of Create Instance of SAP Event Mesh Service.
pradeeppanda-sapPRADEEP PANDAMarch 4, 2022
Created by
pradeeppanda-sap
November 12, 2019
Contributors
pradeeppanda-sap

Prerequisites

  • Postman, API Development environment Tool is available to publish & receive message from queue using REST Protocol
  • Step 1
    1. Open the Postman.

    2. Click on “New” to open a new tab on Postman to work on.

      new tab
    3. Fetch the OAuth2.0 access token to be used for authorization on all subsequent operations in same session

      service keys for rest protocol
    4. Provide the token endpoint URL in Postman URL from the Service Keys for the protocol type HTTPREST.

      Build the postman URL by appending the GRANTTYPE as CLIENTCREDENTIALS and RESPONSETYPE as token

      So the final postman URL should look like this:

    <<tokenendpoint>>?grant_type=client_credentials&response_type=token
    
    <<tokenendpoint>> is to be replaced with the 'tokenendpoint' field of the service key.
    In the Headers tab, enter `Content-Type` as KEY and `application/x-www-form-urlencoded` as VALUE.
    
    
    postman headers

    In the Authorization tab, select the Type as Basic Auth from the dropdown.

    • In Username, provide the <clientid> value from the Service Keys for httprest protocol.
    • In Password, provide the <clientsecret> value from the Service Keys for httprest protocol.
      postman authorization

    Select the POST option in Postman and click on the Send button. You will get the access_token.

  • Step 2

    Open a new tab in the Postman.

    1. Build the postman URL as below
      https://<uri of the rest protocol based section from Service Keys>/messagingrest/v1/queues/<Queue name>/messages.
      Queue name is queue name along with the namespace. Replace the / present in the namespace with %2fwhile executing.

    2. Open the Headers tab add below two key-value pairs.

      KEY VALUE
      x-qos 0 or 1
      authorization Bearer <the retrieved access_token >
      postman header for publishing message
    3. Open the Authorization tab and select the TYPE as No Auth.

      postman authorization for publishing message
    4. Open the Body tab and select the type as raw. And enter some test message in the body.

      postman body for publishing message
    5. Select the POST option in Postman and click on the Send button. If sending message is successful, you shall get a status as 204 No Content.

  • Step 3

    Open a new tab in the Postman.

    1. Build the postman URL as below
      https://< uri of the rest protocol based section from Service Keys>/messagingrest/v1/queues/<Queue name>/messages/consumption

    2. Open the Headers tab add below two key value pair.

      KEY VALUE
      x-qos 0 or 1
      authorization Bearer <the retrieved access_token >
      postman header for publishing message
    3. Open the Authorization tab and select the TYPE as No Auth.

      postman authorization for publishing message
    4. Open the Body tab and select the type as raw. And enter some test message in the body.

    5. Select the POST option in Postman and click on the Send button. If sending message is successful, you shall get a status as 200 OK. And in the body tab you can view the message.

    Which options are true while using postman

Back to top