0

I'm sending a message via enterprise messaging in SAP from Fiori. SAPui5 code as below.

               $.ajax({
                    type: "POST",
                    url: '/messagingrest/v1/topics/SeasonalityTopic/messages',
                    headers: {
                        'Access-Control-Allow-Origin': '*',
                        'Authorization': 'Bearer ' + accessToken, // has a value for accessToken
                        'Accept': '*/*',
                        'Cache-Control': 'no-cache',
                        'x-qos': '1'
                    },
                    data: "hi",
                    dataType: "json",
                    contentType: "application/x-www-form-urlencoded",
                    beforeSend: function (xhr) {
                        //  xhr.setRequestHeader('Authorization', bearer);
                    },
                    success: function (ret) {
                        var aa = 1;
                    },
                    error: function (err) {
                        var aa = 2;
                    }
                });

But this returns below message.

{ "message": "x-qos is invalid" }

Dumi
  • 1,414
  • 4
  • 21
  • 41
  • Here https://help.sap.com/doc/3dfdf81b17b744ea921ce7ad464d1bd7/Cloud/en-US/messagingrest-api-spec.html it says the following: `400 Bad Request In cases of invalid values for request parameters. Content-Type: application/json Response Body: { "message": "x-qos is invalid" }` So it seems that your request parameters are invalid. Is there any further info available in the error message? –  Aug 19 '19 at 13:26
  • @SAPFioriCrew Nope. Not any further info. But when I call above from Postman then it works. I generated the javascript code from the postman tool and used it, but still, I show the same message – Dumi Aug 20 '19 at 04:13

1 Answers1

1

the x-qos is a required header parameter, the possible values are 0 or 1.

Per what I discovered reading some of the documentation:

  • 0: Does not require a confirmation to remove the message from the queue.
  • 1: Does require a confirmation message to confirm delivery and to remove it from the queue.

Some useful documentation: