HTTP REQUEST BODY in application/x-www-form-urlencoded

Hello guys, so I ran into a problem. I have 2 workflows. They are basically the same, except one generates a data table, takes the values of columns, puts them in a string variable and passes to HTTP request body, other takes them from an excel file and passes to HTTP body. When i try to do the Excel running workflow It goes without any errors. But when I try to do it with Generate Data table from Text (text is taken from an excel file) it fails. I cant seem to find the problem, because the variables that im passing to the body are the same. The same format and everything, but one is working, other is not. I preffer to make this problem out and use the one that doesnt use Excel file, because then its fully automated. Here are the bodies…

Excel file generated body (THIS ONE WORKS):

"username=signeda" +
"&password=" + Uri.EscapeDataString("mRID7dy9l9E3HIII") +
"&user_token=" + Uri.EscapeDataString("5cf80c4f395d74cf8b8e6860f0c574cf") +
"&car_id=" + Uri.EscapeDataString(CurrentRow.Item("car_id").ToString) +
"&category_id=" + Uri.EscapeDataString(CurrentRow.Item("category_id").ToString) +
"&quality=" + Uri.EscapeDataString(CurrentRow.Item("quality").ToString) +
"&status=" + Uri.EscapeDataString(CurrentRow.Item("status").ToString) +
"&position=" + Uri.EscapeDataString(CurrentRow.Item("position").ToString) +
"&notes=" + Uri.EscapeDataString(CurrentRow.Item("notes").ToString) +
"&manufacturer_code=" + Uri.EscapeDataString(CurrentRow.Item("manufacturer_code").ToString) +
"&visible_code=" + Uri.EscapeDataString(CurrentRow.Item("visible_code").ToString) +
"&other_code=" + Uri.EscapeDataString(CurrentRow.Item("other_code").ToString) +
"&internal_notes=" + Uri.EscapeDataString(CurrentRow.Item("internal_notes").ToString) +
"&photo=" + Uri.EscapeDataString(CurrentRow.Item("photo").ToString) +
"&photos[]=" + Uri.EscapeDataString(CurrentRow.Item("part_photo_gallery").ToString) +
"&photos[]=" + Uri.EscapeDataString(CurrentRow.Item("part_photo_gallery1").ToString) +
"&photos[]=" + Uri.EscapeDataString(CurrentRow.Item("part_photo_gallery3").ToString) +
"&photos[]=" + Uri.EscapeDataString(CurrentRow.Item("part_photo_gallery4").ToString) +
"&photos[]=" + Uri.EscapeDataString(CurrentRow.Item("part_photo_gallery2").ToString) +
"&photos[]=" + Uri.EscapeDataString(CurrentRow.Item("part_photo_gallery5").ToString) +
"&optional_codes[]=" + Uri.EscapeDataString(CurrentRow.Item("optional_codes").ToString) +
"&optional_codes[]=" + Uri.EscapeDataString(CurrentRow.Item("optional_codes1").ToString) +
"&optional_codes[]=" + Uri.EscapeDataString(CurrentRow.Item("optional_codes2").ToString) +
"&optional_codes[]=" + Uri.EscapeDataString(CurrentRow.Item("optional_codes3").ToString) +
"&optional_codes[]=" + Uri.EscapeDataString(CurrentRow.Item("optional_codes4").ToString) +
"&price=" + Uri.EscapeDataString(CurrentRow.Item("price").ToString)

Generate Data table from text workflow Body (This doesnt work, something is wrong in the format I think):

"username=signeda" +
"&password=" + Uri.EscapeDataString("mRID7dy9l9E3HIII") +
"&user_token=" + Uri.EscapeDataString("5cf80c4f395d74cf8b8e6860f0c574cf") +
"&car_id=" + Uri.EscapeDataString(CurrentRow.Item("car_id").ToString) +
"&category_id=" + Uri.EscapeDataString(CurrentRow.Item("category_id").ToString) +
"&quality=" + Uri.EscapeDataString(CurrentRow.Item("quality").ToString) +
"&status=" + Uri.EscapeDataString(CurrentRow.Item("status").ToString) +
"&position=" + Uri.EscapeDataString(CurrentRow.Item("position").ToString) +
"&notes=" + Uri.EscapeDataString(CurrentRow.Item("notes").ToString) +
"&manufacturer_code=" + Uri.EscapeDataString(CurrentRow.Item("manufacturer_code").ToString) +
"&visible_code=" + Uri.EscapeDataString(CurrentRow.Item("visible_code").ToString) +
"&other_code=" + Uri.EscapeDataString(CurrentRow.Item("other_code").ToString) +
"&internal_notes=" + Uri.EscapeDataString(CurrentRow.Item("internal_notes").ToString) +
"&photo=" + Uri.EscapeDataString(CurrentRow.Item("photo").ToString) +
"&photos[]=" + Uri.EscapeDataString(("part_photo_gallery").ToString) +
"&photos[]=" + Uri.EscapeDataString(("part_photo_gallery1").ToString) +
"&photos[]=" + Uri.EscapeDataString(("part_photo_gallery2").ToString) +
"&photos[]=" + Uri.EscapeDataString(("part_photo_gallery3").ToString) +
"&photos[]=" + Uri.EscapeDataString(("part_photo_gallery4").ToString) +
"&photos[]=" + Uri.EscapeDataString(("part_photo_gallery5").ToString) +
"&optional_codes[]=" + Uri.EscapeDataString(("optional_codes").ToString) +
"&optional_codes[]=" + Uri.EscapeDataString(("optional_codes1").ToString) +
"&optional_codes[]=" + Uri.EscapeDataString(("optional_codes2").ToString) +
"&optional_codes[]=" + Uri.EscapeDataString(("optional_codes3").ToString) +
"&optional_codes[]=" + Uri.EscapeDataString(("optional_codes4").ToString) +
"&price=" + Uri.EscapeDataString(CurrentRow.Item("price").ToString)

I just cant figure out how is the second one not working. The first one in the column photos and optional_codes uses CurrentRow.Item to input the values. The second one has variables with the same values (I checked them out by doing Message box on both of them, that way tried to compare it). Could anyone be so kind and help me figure out the problem?

EDIT: HTTP REQUEST BODY throws an error, that the photos values are bad and it cant upload when running the second body workflow. So to compare, i will attatch 2 First and the most important URL’s values that are being put into the body:

The working workflow:
image

https%3A%2F%2Fwww.signeda.lt%2Fimage%2Fcatalog%2Fproducts-gl%2Fc_112234.jpg

not working:
image

https%3A%2F%2Fwww.signeda.lt%2Fimage%2Fcatalog%2Fproducts-gl%2Fc_112234.jpg

@Povilas_Jonikas

in this ("part_photo_gallery").ToString is part_photo_gallery a variable?

if so use like this part_photo_gallery.ToString

Simliar one for Optional_codes

cheers

Hello Anil,
Without the " Uri.EscapeDataString " ?

Yes, the part_photo_gallery is a variable of string

@Povilas_Jonikas

no with that…everything else remains same…brackets and inverted comma to be removed…if it is a variable

cheers

I tried it with just the part_photo_gallery part, and got this:

@Povilas_Jonikas

What I mean was URI_EscapeDataString(part_photo_gallery.ToString)

cheers

1 Like

Im really thankful for your help, but it still doesnt work. Get the same error, that something isint right with the part_photos_gallery values. If u see up top, i have written the 2 raw bodies. In the one that is working, it doesnt have %20 in front of the part_photos_gallery values, but in the second it does, that whats i think is causing the error. Do you know how to solve it?

I found the problem. When I was generating the data table to text from an excel file cell value, the cell value was like this:

https://forum.uipath.com/t/http-request-body-in-application-x-www-form-urlencoded/564805/7, https://forum.uipath.com/t/http-request-body-in-application-x-www-form-urlencoded/564805/7, https://forum.uipath.com/t/http-request-body-in-application-x-www-form-urlencoded/564805/7, https://forum.uipath.com/t/http-request-body-in-application-x-www-form-urlencoded/564805/7, https://forum.uipath.com/t/http-request-body-in-application-x-www-form-urlencoded/564805/7

It had a ", " in front of every url. When I removed and changed format, it did work. Thanks yet again Anil, ur a beast! :slight_smile:

1 Like

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