# How can I run my API on an image?

I've built an API that takes a url of an image as an argument. Using Import[] I can easily call my API on any url and get the results... but I need to run it on an image created within my notebook.

What is the easiest (and free if possible) way to automatically upload my images and get back urls to feed into my API? I have roughly 100 jpeg images, each is a less than one mB.

Surely there is an easy way to do this, I mean with all this Wolfram-Cloud stuff now in circulation!

• Why not just overload the API definition so it takes a file path as well as a url as a parameter? Assuming of course that your images are already local. Feb 12, 2015 at 20:47
• Because it is a client requirement to have locals trigger "Bad Request" (HTTP status code 400).
– M.R.
Feb 12, 2015 at 20:54
• Can you elaborate the scenario a bit more? Im having trouble understanding. Feb 12, 2015 at 21:00
• Would uri = CloudExport[ExampleData[{"TestImage", "Lena"}], "JPEG"]suffice? Inside the cloud object there is a URI to the image. Feb 12, 2015 at 22:51
• That works thanks @Pickett
– M.R.
Feb 14, 2015 at 0:27

uri = CloudExport[ExampleData[{"TestImage", "Lena"}], "JPEG"]

uri is an expression that contains the URI.