Forum Discussion

c-hell's avatar
c-hell
Occasional Visitor
2 years ago

Send Request POST body parameters

I'm trying to send a post request to a REST API endpoint that requires having a username and password in the body section.

Like http:\\api\endpoint?username=myuser&password=mypass

Now I have the username in a variable and the password also in a password variable.

I tried using code expressions, but I couldn't get them to work according to the documentation, so I tried a workaround and my body looks like this:

Project.Variables.SectionUser+Project.Variables.User1+Project.Variables.SectionPass+Project.Variables.Password1

SectionUser = username=

User1 = myuser

SectionPass = &password=

Password1 = mypass

 

I was hoping that it would create a body string like "username=myuser&password=mypass", but it doesn't seem to work because the password is encrypted of course. If I enter the password into the SectionPass variable directly, it works. It also works if I store the password as a plain string, but not the password type.

 

I also tried to user the Username and Password fields in the Send Request configuration window, but it doesn't seem to work there also. I need to have them in the body.

 

Unfortunately, I'm out of ideas on how to satisfy the requirement by the REST API.