Need help using clover with REST api

Hi,

Please help me know where to get started. I was provided with a REST api that returns json and I’m not sure how to make it work with clover. Here’s what I’ve been doing so far. I’m using the http connector and on the url I typed in https://rest.domain.com/auth then went and filled out the user name and password and the request content and the output file url but I’m not getting any token string return when I run the graph. Also the api is supposed to have an http header requirement in this format: Authorization: user {account_id}:{api_password}. I went to the additional http header properties in http connector but it ended up as Authorization=user {account}:{api_password}. I’m not sure if I’m doing it right. I’m running out of ideas and I really need some help. I hope someone can point me to the right direction.

Thanks.

Hi noob27,

can you send me content of log window and graph file? (You can send it as private message).

Otherwise: if you see “Authorization=user {account}:{api_password}” in properties of component - don’t worry. It is just visualization. Colon instead of equal sign is send (checked by me on 3.2.1 version).

Also try to get working HttpClient on some non-problematic page (http://google.com), or see our example graphs. It would also make a sense to log requests on server side (if possible) so you will see exact content of request.

I hope this helps.

I am having similar issues with using a REST API.

Essentially, I’m unsure of how to reference a variable within “Additional HTTP header properties”. If I set up a parameter or pass the required information through Metadata, how do I reference it? I’ve tried the following and none of them seem to work…

Authorization= OAuth $in.0.token
Authorization= OAuth $0.token
Authorization= OAuth {token}
Authorization= OAuth $token

I got past the first step of getting the auth token by hard-coding my user/pass into the http header but now I can’t use the token I’ve received in subsequent API requests.

Any help would be greatly appreciated.

You can create graph parameters like:


user=jarek
password=megasecret

And then create header property “Authorization” with value “user ${user}:${password}”.

On server, header

AUTHORIZATION: user jarek:megasecret

is received.

Unfortunately this approach can be dynamic just in case:
* RunGraph is used (there you can specify graph parameter value on command line delivered by input port)
* Or graph itself can be externally parametrized.

Currently there is no way you can change parameters on-the-fly by graph itself.

Thank you Jarek.

It is, indeed, unfortunate that we can’t use internal variables within the HTTP headers. I will have to find another way around this limitation.

Thank you for answering the question and providing a possible work-around. I appreciate it.