Message Boards Message Boards

0 Replies
0 Total Likes
View groups...
Share this post:

CloudDeploy function returning error

Posted 3 months ago


I've created a very simple API that imports the "Plaintext" of a URL or a PDF. Here is my code:

urlScraperTest = APIFunction[
   {"url" -> "String"},
   Import[#url, "Plaintext"] &];

And deployed it to the Wolfram Cloud:

CloudDeploy[urlScraperTest, "urlScraper", Permissions -> "Public", CloudObjectNameFormat -> "CloudUserUUID"]


I want to be able to call this API from programs outside of MMA. In testing the code, things seem to work as expected for some URLs. For instance, here is a link to a recipe that I am able to call directly from my browser

This code works fine if I pass it some URLs, e.g. here is a recipe that I am able to scrape from my browser:

I'm also testing this by passing the URL of a PDF that I've stored in a cloud location:

If I enter this location in my browser search bar directly, the PDF renders correctly. But if I try to pass this URL to my Wolfram Cloud api function

If produces a $Failed message. Note: If I call the URLScraperTest[] function directly from a local MMA notebook using the above URL, it does return the results I expect with no error. But I need to be able to call this function from outside of MMA.

I believe the problem is that the URL above contains "illegal" characters for URL encoding, but I've been unable to find a solution. Can anyone suggest a solution?


POSTED BY: Mark Coleman
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract