GET request using httr

Hello!
I am working on connecting to Apple Ads API, after when I created SSL authentication, there is the following recommendation to check if a connection is ok:

curl -X GET \
 https://api.searchads.apple.com/api/v2/campaigns \
 -H 'Authorization: orgId=<OrgID>' \
 -H 'Content-Type: application/json' \
 --cert-type p12 \
 --cert <FILENAME>.p12 \
 --pass <PASSWORD>

source - https://developer.apple.com/documentation/apple_search_ads/authenticating_with_the_apple_search_ads_api.
But I don't understand how I should run it using R.

Could you please help me to understand what R code I should create to run this curl with GET request? which method should I use?

curl and the cli curl both rely on libcurl

suppressWarnings(suppressMessages(library(curl)))
req <- curl_fetch_memory("https://eu.httpbin.org/get?foo=123")
str(req)
#> List of 7
#>  $ url        : chr "https://eu.httpbin.org/get?foo=123"
#>  $ status_code: int 200
#>  $ type       : chr "application/json"
#>  $ headers    : raw [1:202] 48 54 54 50 ...
#>  $ modified   : POSIXct[1:1], format: NA
#>  $ times      : Named num [1:6] 0 0.0294 0.12 0.4432 0.5957 ...
#>   ..- attr(*, "names")= chr [1:6] "redirect" "namelookup" "connect" "pretransfer" ...
#>  $ content    : raw [1:370] 7b 0a 20 20 ...

Created on 2020-09-26 by the reprex package (v0.3.0.9001)

This topic was automatically closed after 45 days. New replies are no longer allowed.


If you have a query related to it or one of the replies, start a new topic and refer back with a link.