Photo Upload Key

From ePrize Developers Wiki

Revision as of 19:58, 13 August 2013 by Geoff-keyes (Talk | contribs)
Jump to: navigation, search

API Home Page :: Contest

Summary

Request a photo upload key associated with this profile, specifying optional display height and width as well as optional thumbnail height and width. Returned to you will be the url that you will be making the POST to (upload_url), the data that you will POST (post_data), and the url that the image will be viewable at once it has been uploaded (photo_url). You must add the binary image data that you want uploaded to the POST data that we return to you from this call with the attribute name of userfile. After successfully uploading the image to the upload_url provided, you can then use the photo_url as the photo element in your contest entry.

Resource

/v1/{apikey}/contest/photo_upload_key

Valid Methods

POST

Resource Arguments

Note: resource arguments are always required.

apikey: Your API Key.

Parameters Required

profile: Canonical Location of a user profile. See: Fetch Profile by Key.


Optional parameters

g_height - The height that the image will displayed at in the gallery

g_width - The width that the image will displayed at in the gallery

t_height - The height of the thumbnail of this image

t_width - The width of the thumbnail of this image



Example: Submitting a successful request

Summary

Demonstrates expected inputs and outputs

Request

profile: http://{client}.promo.api.eprize.com/v1/{apikey}/profile/{uid}.{webkey}

Response

HTTP Status Code: 200 OK


<?xml version="1.0" encoding="UTF-8" ?>
	<result>
		<photo_url>https://s3.amazonaws.com/eprize-imageupload/{apikey}/PROMO-photo-{uid}-ENTRYID-RANDOM_KEY.jpg</photo_url>
  		    <post_data>
    		    <basename>PROMO-photo-{uid}-ENTRY-RANDOM_KEY</basename>
    		    <ef>ENV</ef>
    		    <g_height>480</g_height>
		    <g_width>640</g_width>
    		    <issec>1</issec>
    		    <lang>en</lang>
    		    <pid>API_KEY-photo-{uid}-ENTRY-RANDOM_KEY</pid>
    		    <promo>PROMO</promo>
    		    <random_key>RANDOM_KEY</random_key>
    		    <t_height>100</t_height>
		    <t_width>100</t_width>
    		    <uploaded>1</uploaded>
  		</post_data>
  		<upload_url>https:/p5upl-node01.ec2.eprize.net/cv3_index.php?pid=API_KEY-photo-{uid}-ENTRY-RANDOM_KEY&random_key=RANDOM_KEY&t_width=100&t_height=100&g_width=640&g_height=480&ef=d&lang=en&issec=1&promo=PROMO</upload_url>
	</result>


What do you do with this Response?

  • Add the following to post_data where {binary_image_data} is the binary data from the image being uploaded: userdata: {binary_image_data}
  • Make a Post to upload_url with post_data as the POSTDATA
  • Make a contest/entry/ call with the photo_url as the photo element of the entry.
Personal tools