cancel
Showing results for 
Search instead for 
Did you mean: 

Calling REST POST but MissingApiVersionParameter error

planteksz
Explorer
0 Kudos
1,034

Hi,

I'm trying to trigger an Azure Logic App from ByDesign but for some reason, even though I have the api-version in the URL it still doesn't run that Logic App. It works perfectly from Postman though. I get the following error (400 - Bad Request):

I created a Web Service in Cloud Application Studio that is using the generated POST request URL details from the Logic App. After that I created the communication scenario, then in ByDesign I created the Communication arrangement. Then I created an action for triggering this Logic App where I execute the external webservice call:

import ABSL;

var HttpMethod = "POST";
var HttpResource = "/workflows/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/triggers/manual/paths/invoke"; 
var ContentType = "application/json";                        
var Body = ""; 
var HeaderParameter : collectionof NameAndValue;  // not required

var URLParameter: collectionof NameAndValue;
var URLParameterEntry :NameAndValue;

URLParameterEntry.Name = "api-version";
URLParameterEntry.Value = "2016-10-01";

URLParameter.Add(URLParameterEntry);

URLParameterEntry.Name = "sp";
URLParameterEntry.Value = "%2Ftriggers%2Fmanual%2Frun";

URLParameter.Add(URLParameterEntry);

URLParameterEntry.Name = "sv";
URLParameterEntry.Value = "1.0";

URLParameter.Add(URLParameterEntry);

URLParameterEntry.Name = "sig";
URLParameterEntry.Value = "xxxxxxxx-xxxxxxxxxxxxxxxxxxxxxxxx";

URLParameter.Add(URLParameterEntry);

URLParameterEntry.Name = "AccountingPeriodVar";
URLParameterEntry.Value = this.AccountingPeriod.content;

URLParameter.Add(URLParameterEntry);

URLParameterEntry.Name = "CompanyCodeVar" ;
URLParameterEntry.Value = this.CompanyCode.content;

URLParameter.Add(URLParameterEntry);

var wsresult = WebServiceUtilities.ExecuteRESTService("CS_Trigger", "Trigger_EWS", "POST", HttpResource, URLParameter, HeaderParameter,ContentType, Body);

var contentResult = wsresult.Content;

The resulting RequestURL seems good, I tested it in Postman. But for some reason it still believes that the api-version is missing from it so the call is seemingly never made.

The RequestURL looks like this in CAS: https://*********.*********.logic.azure.com:***/workflows/***************************************/tr...

Can anyone help me with this?

Thank you!

Accepted Solutions (1)

Accepted Solutions (1)

planteksz
Explorer
0 Kudos

After months of investigation from SAP support finally they figured out what was the problem.

Instead of var Body = "";

I should have declared it like var Body = "{}";

This solved the issue and now I was able to trigger the POST request.

Answers (1)

Answers (1)

kursatbeyoglu
Explorer
0 Kudos

Hi Szilvia.

In my opinion, there is a problem in your using in 'sp' of parameters. Because of %2F is mean '/' char in HTML url structure. You can refer HTML url encode.

Can you change code and try like this : '/triggers/manual/run' instead of '%2Ftriggers%2Fmanual%2Frun'.

But probably, it won't work. I mean, you send 'sp' of parameters as 'sp=/triggers/manual/run' but system will understand as if 'a path' because it contains '/' char. System wants to see in parameter a value.

You know, when need define a path, we use '/' special char.

I hope it helps.

planteksz
Explorer

Hi,

Thank you for this suggestion, my coworker had the same idea a few days ago. So I tried this idea you mentioned, sadly no luck and I tried with encoding the whole URL from "workflows" with special characters, then tried with non-encoded version, tried to just encode the api-version, or the triggers/manual/run, no luck. I opened a ticket with SAP about this, I hope they can figure out what's wrong with this call.