Trying to explain the following with a paragraph in a comment would be painful, so take a look at:
api_url <- "https://api.thomsonreuters.com/permid/match/file"
records <- "C:\\Users\\U6028364\\Downloads\\Organization_input_template_with_examples.csv"
httr::POST(
url = api_url,
body = list(
addressFile = httr::upload_file(records),
),
encode = "multipart"
) -> resp
httr::stop_for_status(resp)
get_data <- content(resp, "text")
the only real change is that you need to use the encode parameter (also, you missed a " in your question code).
I don't have access to the TR API so I can't test this. However, https://docs-developers.thomsonreuters.com/1544617757924/45690/wwhelp/wwhimpl/js/html/wwhelp.htm#href=PermID%20Service/PermID%20APIs%20User%20Guide.1.27.html says this is the curl command line to do what you are trying to do:
curl -X POST https://api.thomsonreuters.com/permid/match/file
-H "Content-Type: multipart/form data"
-H "x-openmatch-numberOfMatchesPerRecord: 1"
-H "x-openmatch-datatype: Organization"
-H "X-AG-Access-Token: <token>"
-F [email protected]
You're missing some things if that is the case and also using an improper body, so this might work better:
httr::POST(
url = api_url,
httr::add_headers(
`X-AG-Access-Token` = "YOUR_ACCESS_TOKEN_WHICH_YOU_RLY_SHLDNT_PUT_DIRECTLY_IN_R_SCRIPTS"
)
body = list(
file = httr::upload_file(records)
),
encode = "multipart"
) -> resp
I have no idea if the other "openmatch" headers are required or not.