I have an HTML file saved locally that I would like to convert to PDF using httr and pdfcrowd.com API. I am using the following code:
library(httr)
r <- POST(url="http://pdfcrowd.com/api/pdf/convert/html/", config=list(authenticate(user=myusername, password=myAPItoken)),
encode="multipart", body=upload_file(path=< my local path >))
content(r)
When I run this I get the following output saying that I am missing the src field. My understanding is the src field is the path to the file. Any help is appreciated:
"No data to convert. Missing src field."
Based on the documentation and error message, I suspect you want:
library(httr)
r <- POST(
"http://pdfcrowd.com/api/pdf/convert/html/",
authenticate(myusername, myAPItoken),
body = list(src = upload_file("my local path"))
)
content(r)