API problems with R

Post Reply
carlo1202
Posts: 16
Joined: 01 Mar 2022, 09:52

Hello,

I am trying to extract all my Composite_Application_Provider instances with the get all instances API. I am succeeding in extracting all the applications with the get all applications API so there is no problems with the token.

I am using R and got the following error when using the httr library: Error in curl::curl_fetch_memory(url, handle = handle) :
URL using bad/illegal format or missing URL

And got the following error when using the RCurl library: Error in function (type, msg, asError = TRUE) :

Can you please explain why this is happening and how to solve it? I tried both single quotes and doubles quotes already for the headers and URL to account for special characters.

Best regards,

Carlo
carlo1202
Posts: 16
Joined: 01 Mar 2022, 09:52

An update from my side,

I was able to establish the connection by not using the example R request coming from the API documentation: "res <- VERB("GET", url = "{{api-domain}}/api/essential-utility/v3/repositories/{{api-repo-id}}/classes/{CLASS_NAME}/instances?maxdepth=1&slots=name^application_provider_purpose^lifecycle_status_application_provider^lifecycle_model_for_element^stakeholders&updatedAfter=2022-01-01&filter=name^eq^My Application&start=1&count=50&directinstances=false", add_headers(headers))"

Instead, I generated an R request with Postman which contained much fewer text than the one listed above. I hope this helps anyone.
jasonp
Posts: 70
Joined: 01 Jul 2017, 07:05

Hi,

this could be a url encoding issue. I believe that Postman automatically encodes the URL query string (escaping characters such as "^" and "@") before sending it. Do you know if your program is encoding the URL query string, before sending the request?

Thanks,

Jason
carlo1202
Posts: 16
Joined: 01 Mar 2022, 09:52

Hi Jason,

R does not encode automatically but I encoded it to account for this using a function offered by R. Postman on the otherhand just leaves out all the special characters such '^' and '@' in the url. That being said, should they still be there in API documentation?

Best regards,

Carlo
Post Reply