Issue with API

Hello All,
I need to integrate with API and extract the data. So here I need to pass registration number dynamically which not working, If I give one registration number then I’m getting the data. How can I pass the variable dynamically so that I can get data for all the registration number? Please help me sorting the issue.

To pass a variable dynamically to an API request in UiPath and retrieve data for multiple registration numbers, you can use a loop, such as a For Each activity, to iterate through a list of registration numbers and make individual API requests for each number. Here’s a step-by-step guide on how to achieve this:

  1. Create a List of Registration Numbers: First, create a list (e.g., a DataTable, an Excel file, or a collection variable) containing all the registration numbers for which you want to retrieve data.
  2. Use a For Each Activity:
  3. Make API Request: Inside the For Each loop, use an HTTP Request activity or any other suitable method for making API requests. Pass the current registration number as a variable or parameter in your API request.
  • Define the API URL with a placeholder for the registration number, e.g., https://api.example.com/data?registrationNumber={registrationNumber}.

You try video you will get clarity

@ISBS_ROBOT

You can go through this

@ISBS_ROBOT

@ISBS_ROBOT

You can create it dynamic…

"Endpointuurl" + registrationvariable

This is how you can pass it

Cheers

Even I did the same. But here In for each activity I had given add data row activity, through which I’m unable to get data.

@ISBS_ROBOT

Can you please show what you are trying?

If ypu are looping through datatable then please try to use like this

"Requesturi" + currentRow("ColumnName").ToString

Cheers

I tried that too bro, not working.

@ISBS_ROBOT

Please properly show what you tried…what is the hardcoded uri that worked …then we can suggest the way…not working will not help in resolving it

Cheers

U can try mentioning like this
I just took url as an example

apiBaseUrl = "https://api.example.com/data"
apiEndpoint = $"{apiBaseUrl}?registrationNumber={registrationNumber}"

If you are getting from an array of registration. Number then

Assign registrationNumbers = {"RegNumber1", "RegNumber2", "RegNumber3"}  // Replace with your registration numbers

For Each registrationNumber in registrationNumbers
    Assign apiUrl = "https://api.example.com/data?regNumber=" + registrationNumber
    
    // Make the API call using apiUrl
    
    // Process the API response as needed
    
    // Continue with any additional logic
End For Each

Hope this helps

Cheers @ISBS_ROBOT

@ISBS_ROBOT

As per the info provided looks like your account has reached the maximum hit limit per day or the maximum usage limit your account has…please use a different account to check or wait and use it after few days as per the limit that the site gives you

image

Hope this clears

cheers

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