Issue with downloading audit report using API

I have used the ‘Orchestrator HTTP Request’ activity to get the access token. I have put the token request into a jsonPayload. Then we used ‘HTTP Request’ activity and provided the access token which we obtained by the earlier activity, in OAuth2Token field and also provided the required API Endpoint.
But running the bot, we are getting the error saying “You are not authenticated” even though access taken is being provided.

If anyone of you faced the same type of error and has the solution , kindly help me in resolving this issue.

Thanks

Hey @Mattapalli_Kiran, Welcome to forum.

Are you passing the headers in the request?

Also, Can you please check below link:

Hi @Mattapalli_Kiran ,

Make sure that you are entering token with the bearer text in the Authorization parameter like below. thanks.

Authorization → Bearer+YourToken

yes, I have passed the headers in jsonPayload but still facing the same error, "You are not authenticated " with Status code: 403

{‘Content-Type’: ‘application/json’,
‘Accept’: ‘application/json’,
‘Authorization’: ‘Bearer " + in_auth2_token + "’,
‘x-UIPATH-AuditedService’: ‘Orchestrator’
}

yes, I have passed the header through jsonPayload as below.

{‘Content-Type’: ‘application/json’,
‘Accept’: ‘application/json’,
‘Authorization’: 'Bearer " + in_auth2_token + " ',
‘x-UIPATH-AuditedService’: ‘Orchestrator’
}

Did you checked this ? Coz it is working fine for me using below documentation.

Also, please have a look at below link.

Hi @Mattapalli_Kiran ,

ok i understood that you are using orchestrator Http request to authenticate with your orchestrator by sending parameters as json payload. i assume that you are successfully authenticated with orchestrator and received token.

Now you are using normal http request activity using some orchestrator services by passing your bearer token. is my understanding correct.

In this case while using http request activity select authentication none and pass the below parameters as parameters not in the json body directly. please try and let us know. thanks

X-UIPATH-TenantName → your orchestrator tenant name
Authorization → Bearer + Your token

Yes,I have checked.

FYI,
I am using the API ( /odata/AuditLogs/UiPath.Server.Configuration.oData.Reports ) for downloading the audit report . All other api s were working fine but using this api still showing the same error saying "You are not authenticated "

Thanks

@Palaniyappan @loginerror @Pablito @Srini84

@Mattapalli_Kiran

Welcome to forums

I believe if you are using HTTP Request activity then you have to pass the cloud url as mentioned in the documentation, also you need to get the access token

If you are using Orchestrator HTTP Request then no need of cloud url and access token to generate, because it is already connected to orchestrator

Hope this may help you

Thanks

1 Like

Thanks for the reply and
yes, your understanding is exactly correct.

And , I have tried your suggested way by giving the parameters . But , unfortunately still facing the same error.

Thanks .

Hi @Mattapalli_Kiran,
I could get the audit report without any issues. Can you please check whether you have tried it the below way?

  1. Get access token with “HTTP Request” activity, deserialize and assign the token to a variable (eg: access_token). Make sure you are using Client_ID and User_Key to authenticate in Studio if it’s cloud orchestrator.

Reference : Consuming Cloud API (uipath.com)

  1. Use the same activity for the API calls.
    Method: GET
    End point : “https://cloud.uipath.com/<account_name/<tenant_name>/odata/AuditLogs/UiPath.Server.Configuration.OData.Reports”
    Body format : application/json
    Headers: as below

Define Result & Status also as required (eg: outAudit,outStatus).

  1. Write the result value of above HTTP directly to a csv file using Write Text File. No need of deserialization as it returns a CSV containing the data.
    image

  2. Sample output received.

Haven’t tried with “Orchestrator HTTP Request” activity. Let me know if it’s helpful.

1 Like