Project

General

Profile

Support #3826

REST API call with authentication

Added by Vadim 2 months ago. Updated 5 days ago.

Status:
Closed
Priority:
Normal
Assignee:
Target version:
RapidDeploy - 5.0-FIX
Start date:
07/20/2021
Due date:
% Done:

0%

Estimated time:
Affects Version:
RapidDeploy - 5.0-FIX
Timesheet Code:
Additional version details:

Description

Hello.

Am trying to configure a REST API call to a remote server with authentication. Cannot find a place where to put a basic authentication (user-password) data. Can You please help? :)

Best regards,
Vadim.


Files

clipboard-202107201716-ad47c.png (6.4 KB) clipboard-202107201716-ad47c.png Vadim, 07/20/2021 02:16 PM
rest_api_call (72.2 KB) rest_api_call Vadim, 07/20/2021 02:38 PM
#1

Updated by Vadim 2 months ago

Hi.

Seems that I found that field. "Request Text Input Param" accepts authentication data and there is no unauthorized error then.
But now I cannot send necessary data to a REST server. Where should I set a payload for a PUT request? I tried all available and each time I get "java.lang.IllegalArgumentException: The content cannot be null". I attach log.

P.S.: Unfortunately I cannot rename ticket. :)

P.P.S.: You have typing error in a REST API Call task:

Best regards,
Vadim.

#2

Updated by Vadim 2 months ago

Forgot to attach log.

#3

Updated by Rafael 2 months ago

  • Status changed from New to In Progress
  • Assignee set to Rafael
  • Target version set to 5.0-FIX
#4

Updated by Vadim about 2 months ago

Hi Rafael.

Don't You have any information about how to make PUT request with authentication and payload attached? :)

I know that it's possible to use Shell command runner with curl, but as soon as there is Rest call task I'd like to use it. Or there are some technical problems and curl can handle better? :)

Best regards,
Vadim.

#5

Updated by Rafael about 2 months ago

  • Status changed from In Progress to Feedback
  • Assignee changed from Rafael to Vadim

Hi Vadim,

Sorry for this delay! This ticket just fell down in my tasks list... :-)

Thanks for the spot on the typo, the thing is you actually found 2 typos, and the second one is the one causing you troubles.

You can see how there are 2 resources called "requestTextInputParam", well, they should be "requestTextInputParam" and "requestDataInputFilePath". And this is how the task works:

1) It will check the resource "requestTextInputParam" and return the parameter name referenced here, i.e. something like "${requestBody}". If you want to specify the request body as text directly in the orchestration or as a data dictionary entry, you first will need to use a "Assign String to Variable" task (https://docs.midvision.com/LATEST/rapiddeploy-orchestration/resources/tasksMetaData.html#d1e2431) to assign text to an orchestration parameter to be referenced then in the "REST Service Call" task.

2) If the "requestTextInputParam" resource is not set, then the task will check the "requestDataInputFilePath", the one that's currently missing in the documentation, and will basically load the file pointed by this path as the request body, either inside the project package, using the "${ARCHIVE_ROOT}" buit-in variable, or at whatever location on the target server you want to specify. This is personally the option I would choose.

If you want to use the second option that is not currently shown as a default task resource, just add a new resource in the task with this name manually using the "Custom Task Resource" option and it will work straight away.

Regarding the authentication issue, if you are using a basic access authentication, as defined here:

https://en.wikipedia.org/wiki/Basic_access_authentication

You can use the headers task resources "headerKeyValueSplitRegex", "headerParamsSplitRegex" and "headerParamsValue", as in the following example:

  • headerParamsValue: HEADER1=VALUE1;HEADER2=VALUE2;HEADER3=VALUE3
  • headerKeyValueSplitRegex: =
  • headerParamsSplitRegex: ;

Note the "headerParamsSplitRegex" resource defines the character that splits each key value pair for each header entry, a semicolon in this case (;), and the "headerKeyValueSplitRegex" resource defines the character that splits the key from the value, an equal symbol in this case (=).

The POST parameters work in a similar way (postKeyValueSplitRegex, postParamsSplitRegex and postParamsValue), but they only work for a POST request, not for a PUT request.

Thanks for the spot! I'll be fixing the typos you found. I hope I could help you with my explanation! :-)

Cheers!

Rafa

#6

Updated by Vadim about 1 month ago

Hi Rafael.

Thank You very much for the explanations! Everything is Ok now. :)

Best regards,
Vadim.

#7

Updated by Rafael about 1 month ago

  • Status changed from Feedback to Marked for Closure

Hi Vadim,

I'm glad I could help, if you don't have any other concern on this I'll be closing this ticket in a few days time.

Cheers!

Rafa

#8

Updated by Rafael 5 days ago

  • Status changed from Marked for Closure to Closed

Also available in: Atom PDF