I have to call a REST API whose end point is something like https://XXXX.yyy/ws/rest/api/tasks/user/zzz , where zzz is the user id. As far as I know, the configuration of the API methods of connectors in Studio doesn’t allow the use of variables in the end point and if I use parameters the URL that is called is in the form https://XXXX.yyy/ws/rest/api/tasks/user/?user=zzz.
I have discovered that the way to do that is described in the online help, which I hadn’t read carefully. It passes by puting a variable, eg, {{user}} in the REST API path.
However, I can’t test it because a strange thing is happening: the first time that I tested the workflow widget that calls the API I got an error from the API and so I went to the connector to replace the variable part of the end point to a fixed value. After doing that, when I go selecting the operation in the workflow, it shows no methods/operations, but when I go to the connector it shows one. See attached screen captures.
Note: what I wanted is that the last part of the end point was {{user}} , so I can indicate the user (which will be {{userId}}) when calling the API.
I would enable logging and check the rest logs to see what is happening.
But a guess could be that the absolute path works differently with or without variables in the path. Just a hunch, can’t say that for a fact.
When you add the variable it should pop up under your parameters also. It might need some sleigh of hands sometimes to get it to populate.
And also, make sure that you have selected your model as output.
But it feels like something is wrong with the URI, the logs would tell if so.
I created a third connector, with a completely different name, but when I selected it in a workflow, no operations are shown, exactly like what happened with the other two.
I have discovered the solution. As soon as I have more time, I will explain what I was doing wrong, because someone may “be trapped” in the same situation, which is not detailed in the help website.
For others who stumble here, if you need to specify a variable in the URL string, this is called a “path” variable.
To initiate a path variable, when you first create the Operation, just beneath the Identifier, in the Path section, type /path/to/{myVar}. Once you put the “{myVar}” part, it will automatically create your Parameter for you. If you had initially create this variable, delete the variable first, then re-add the variable into the Path section.
Example:
Type in the path (in my example “{urlString}”):
Then check your Parameter to ensure the kind is “Path”:
Thank you @daniel. As I wrote before, I already solved my problem, but you teach me another way of doing much the same and maybe useful in other situations.
Regard