How to pass --data-binary "@roles.txt" in HTTP request - Uipath studio

Hi Folks,
I’m trying to add the roles to specific user with help of “Roles.txt”, this will connect to the internal UNIX server and run will get the result about roles assigned or already assigned. I don’t have any issue with header passing in http request.

Kindly help how to pass --data-binary “@roles.txt” in HTTP request along with header in UiPath Studio

Command I would like to use for this activity in http request:
curl -X POST https://XXXXXXXXXXXX -k --header “environment: ” --data-binary “@roles.txt

@Jayaram_Aita,

In UiPath use HTTP Request activity with attachment as described in this thread.

Thanks,
Ashok :slight_smile:

Have you tried passing roles.txt via:

  • Attachments
    OR
  • File Attachments

grafik

Also check the Endpoint docu (please share with us if possible). Maybe the roles.txt is to pass by the body along with a content type / format definition

Thank you.
I tried passing the file after attachment section and passing that in Body not worked. I tried using read and write text file by assigning it into body , tried adding it under parameters section. No luck. Any other options, can I try here by giving the file to read from UiPath to pass --data binary in http request. or anything I need to do it in BODY section to pass from UiPath studio. Please advice.

screen2

can you check and share?

FSPS_roles.xaml (12.1 KB)
I attached complete xaml file by eliminating IP’s and all, please have a look.

thanks for sharing the XAML

Unfortunately, we cannot derive any hints on which api used, as the endpoint is redacted to
https://XXXXXXXXXXXX

we do know, that the HTTPRequest Activity can have some blockings, when using different methods to pass an attachement. So you can do:

did you attach the file in this manner.

also you can try to read the .txt file convert it to a byte array/base64 and send that in the body that should work.

if there is some documentation for the api that would be helpful as mentioned previously by peter

Yes. I did the same way.
Below is the API reference and we included this logic by customised in our script already. Now we just need to pass the file content to trigger, It might be helpful for you, please have a look once.

https://www.postman.com/oracledevs/workspace/oracle-identity-cloud-service-idcs-rest-apis/request/29850-4aeca92a-7877-4e3e-bdbe-ff065a30398e

curl --location --globoff ‘{{HOST}}/admin/v1/Grants’
–header ‘Authorization: Bearer {{access_token}}’
–header ‘Content-Type: application/json’
–data ‘{
“grantee”: {
“type”: “User”,
“value”: “”
},
“app”: {
“value”: “”
},
“entitlement” : {
“attributeName”: “appRoles”,
“attributeValue”: “”
},
“grantMechanism” : “ADMINISTRATOR_TO_USER”,
“schemas”: [
“urn:ietf:params:scim:schemas:oracle:idcs:Grant”
]
}’

Maybe we have misunderstood. What it the relation from second shared CURL to first shared CURL? Which API Endpoint is used / needed?

First one is customised API curl URL which we are using rather than the second shared one (this is the main reference API which we referred)
Below is the customised curl syntax to run it directly from our server.
curl -X POST https://<server_name>/refresh/configure_user_roles -k --header "environment: " --data-binary "@roles.txt""

thanks for the feedback

  • we gave a few suggestions we can be already modified like:

  • placing the file content as base64 String in the body, testing different content-types like: application/octet-string

  • using HTTP Client

We would assume that also those variations can be checked with Postmn in parallel as well

Thank you for the advice.
I tried placing the file content as base64 String in the body, but not taking as expected. Is anywhere i need to pass base64 String value to be picked ?

I tried to change the content-types like: application/octet-string; multipart/form-data; application/json; application/xml, but no luck.

In Post man , under body section , suggested to use binary format to select the desired file to send the request, this i need to recheck one more time.

However , I understood that, it has to pass it through base64 String in the body in HTTP request(Note : I tried directly passing file content in body, not working), but something I’m missing here to do, please advice.