123RF Value Added Reseller – Downloading Content using the 123RF API (Part 5 of 5)

 

Now that we have checked and verified that we have sufficient download credits loaded into our Customer ID, we can start to download content from 123RF.com.

About the 123rf.images.download API Method

The 123rf.images.download API method requires the following arguments.

Arguments Description
apikey This APIkey is the commercial API key that you will be using to interface with 123RF
accesskey This key is only given to the commercial key holder
custid The customer ID is unique to you. This information will be given once you have signed up for the Value Added Reseller Program
resolution This will tell the API the image size that you’re interested to download. You may get a list of image sizes available for download from with this API call: 123rf.images.getDownloadSizes
imageid This will tell the API the image that you’re interested to download

Please note that in order for this method to work,  you need to “sign” it with the “APIsign” method (API signature (apisign)). We’ll take you through this tutorial so that you can understand the API sign better and how it works in the big scheme of things.

Step 1: Compiling the necessary information

In this example, we will be using 5 pieces of information…

  1. Commercial API Key = b59e8b113748a3a0676045573eb667b2
    Available from http://www.123rf.com/api/key/list.php – look under Commercial Key section
  2. Secret Key = 8b5be6e0fad722
    Available from http://www.123rf.com/api/key/list.php – look under Commercial Key section
  3. Access Key = 44dacbef
    Available from http://www.123rf.com/api/key/list.php, click on the “Additional Info” link for the Commercial Key above.
  4. Customer ID = b55310528064e5e
    Customer ID is given to you once you join the VAR program.
  5. Resolution = blog
    The resolution of a file is very important. Do make sure that you choose the correct resolution that will meet the requirements of your intended use. For example, do not download an S size image for a 10 foot high wall decal.
  6. Imageid = 7362823
    This is just a reference image that I will be using throughout all my examples in the tutorial.

Now that we have gotten the necessary information, we can proceed to create the API sign which is another required argument to be sent to the API call …

Step 2: Generating the MD5 Hash for API Sign

In order to create the MD5 hash for API sign, we need to first determine the required arguments that have to be passed to the API call. This is the example that the documentation has given us:

http://api.123rf.com/rest/?method=123rf.images.download.V2&accesskey=564e4173&apikey=567h78c44fd62a1092c4af8f922e5dd5&custid=469484b1b4w2w&imageid=187887&resolution=high&apisign=0ee38590f4ba09999a8f01df8a5aa632

It is then evident that we require :

  1. accesskey
  2. apikey
  3. custid
  4. imageid
  5. resolution
  6. apisign

Next, according to the APIsign documentation we need to create the API signatures (apisigns) by using a combination of the secretkey and other arguments needed by API call in alphabetical order, argument name followed by the value.

The structure of the API signature looks like this <secretKey>accesskey<accesskey>apikey<apikey>custid<custid>imageid<imageid>
method<method>resolution<resolution>

Please note that resolution comes after method because it is arranged ALPHABETICALLY!

Plugging in the variables gives us this string:

8b5be6e0fad722accesskey44dacbefapikeyb59e8b113748a3a0676045573eb667b2custidb55310528064e5e
imageid7362823method123rf.images.downloadresolutionblog

Next, we need to pass this through a MD5 hash (using MySQL or PHP) to yield 417130bb9a9e48c00f85915e695f8ca3

Step 3: Construct the URL that will be passed to the API method

We will now construct the URL that the API call is expecting and append the API sign at the back.  This is what we get…

http://api.123rf.com/rest/?method=123rf.images.download&accesskey=44dacbef&apikey=b59e8b113748a3a0676045573eb667b2&custid=b55310528064e5e&imageid=7362823&resolution=blog&apisign=417130bb9a9e48c00f85915e695f8ca3

Click on the link above, and you’ll see that the XML document will return something that looks like this:

downloadFile

The XML contains the link that you will have to click on to download the designated content from 123RF servers.  Please note that when you call this API, the appropriate number of credits will be deducted from your account.

Recommend this story :
Back to Top ↑

Leave a Reply

Your email address will not be published. Required fields are marked *