Http request set Variable

Hello can someone tell me how to write the variable at request. I already have many failed attempts.
It should always be listed the last month period when we start Uipathstudio. Variable value I have already written and works.


Can you try to use Parameters property in Properties panel?


I have only one variable. Do you think I should make 2 variables?


Do you think I should make 2 variables?

Yes, it’s better I think.
If your string is "from=2021-12-01&to=2021-12-31", we can extract each value as the following expression.

mc = System.Text.RegularExpressions.Regex.Matches(yourStr,"\d{4}-\d{2}-\d{2}")



Note: mc is MatchCollection Type

OR directly



Sorry I dont understand. I have no experience with regex. Should I write it in Parameters or in assign activity?


Alright. Can you try the following steps?

First, assign each value to variable (Let’s say strFromVar and strToVar) using Assign activity.



Next, check content of the variable using WriteLine activity, if necessary.

Finally, set Parameters property of HTTP Request as the following


Ok. what do you mean with yourStr?
What should I write there?


This will be str_Period. However, I just found you make this variable from the expression in your first post. (Sorry, I didn’t notice it.) So, the following is better.

strFromVar = new DateTime(Now.Year,Now.Month,1).AddMonths(-1).ToString("yyyy-MM-dd")
strToVar = new DateTime(Now.Year,Now.Month,1).AddDays(-1).ToString("yyyy-MM-dd")


Thank you for the answers. I tried both of them also with regex. But I get the same error. Maybe you know how I write it this variable Parameters on the Endpoint? I only get the information if I write the date manually on the endpoint:((


Unfortunately, HTTP request wizard doesn’t support variable.
So first you need to check it using static value with the wizard.
if it works well, next, set variable and test by actual run(debug).

End point will be https://..........api/v1/activities
and for now set Parameters like the following as not URLSegment but GetOrPost.

|Name|Value     |Type     |
|to  |2021-12-31|GetOrPost|


Unfortunately, it did not work. It only works when I write it like this at Endpoint: https://…com/api/activities?from=2021-12-01&to=2021-12-31&
I should not write a date in Value. when we start Uipath studio it should automatically check today’s date, and only list previous month period. for example if we are now in month January the request should automatically check last month in case December.


As I mentioned,

Unfortunately, HTTP request wizard doesn’t support variable.

So, first can you try like the following?


Oh sorry! yes It works like this


If it works well, can you try to modify Parameter property in Property panel (not Wizard)?



Then run as debug and check if it works


ok it’s weird but it works!But you must not touch the Http request after that. if I open the wizard again then no longer works. After that you have to do the same again. But I don’t touch there anymore :)) Thanks for the help. that was the solution

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.