Web Services XML-RPC APIiStockphoto provides web services via an XML-RPC API. See http://www.xmlrpc.com/spec for a basic introduction to the XML-RPC web standard. The XML-RPC web service provides access to a wide range of iStockphoto.com functionality and content including:
Login, or contact Support for more information on gaining access to the API methods and documentation. More information can also be found in the XML-RPC webservices API forum. Header
POST /webservices/xmlrpc/?sessionID=000012002002301230120320660 HTTP/1.0
User-Agent: [Requesting Application] ([operating system])
Host: www.istockphoto.com
Content-Type: text/xml
Content-length: [bytes]
Body
<?xml version="1.0" encoding="utf-8"?>
<methodCall>
<methodName>istockphoto.test.test</methodName>
<params>
<param>
<value>
<struct>
<member>
<name>name</name>
<value><string>value</string></value>
</member>
<member>
<name>name2</name>
<value><string>value2</string></value>
</member>
</struct>
</value>
</param>
</params>
</methodCall>
Success
<?xml version="1.0" encoding="utf-8"?>
<methodResponse>
<params>
<param>
<value>
<string>
[escaped-xml-payload]
</string>
</value>
</param>
</params>
</methodResponse>
Error
<?xml version="1.0" encoding="utf-8"?>
<methodResponse>
<fault>
<value>
<struct>
<member>
<name>faultCode</name>
<value><int>[error-code]</int></value>
</member>
<member>
<name>faultString</name>
<value><string>[error-message]</string></value>
</member>
</struct>
</value>
</fault>
</methodResponse>
XML PayloadThe string value in every response is a block of escaped XML. To use the response value a developer simply needs to un-escape and parse the XML block. Every un-escaped XML block will contain a <istockphotoResponse> tag, and all response information will be contained within that tag. The <istockphotoResponse> tag will include a sessionID parameter that can be re-used in the next request. An example of an un-escaped XML payload is:
<istockphotoResponse sessionid="000123401200002312">
[xml data pertinent to the request]
</istockphotoResponse>
Certain methods that do not require authentication are session-based (e.g., istockphoto.search.browseCache) and so require a valid sessionID to be included in the HTTP request URL. In such cases, the developer can use the sessionID value returned in the previous XML-RPC response for the next request without explicitly calling the istockphoto.auth.login or istockphoto.auth.loginWithToken methods.
The sessionID can and will change during a session, so the most recently provided value should be used.
Login Flow DiagramLogin Token Flow DiagramSession Flow DiagramAll requests to the XML-RPC web services require authorization. Developers may gain access to the web services by submitting a request for an apiKey (contact Support for more information). The apiKey must be sent as a parameter with every XML-RPC method call.
Host NameThe default host name for requests is www.istockphoto.com. Some methods (such as istockphoto.auth.login) require the use of secure connection and must be sent to secure.istockphoto.com via an SSL encrypted HTTPS connection. PathThe path for all XML-RPC requests is /webservices/xmlrpc/. ParametersRequests to methods that require authentication should include a sessionID URL parameter such that the HTTP POST path might look like "/webservices/xmlrpc?sessionID=0000213003400002343240". Image thumbnails cannot be downloaded directly through the XML-RPC interface. However, constructing a URL to download an image is quite simple:
http://www.istockphoto.com/file_thumbview/[file ID]/[thumbnail size]/
In this example, file ID is replaced with the ID of the file, and thumbnail size is replaced with an integer: 1 for the small thumbnail, 2 for the large watermarked thumbnail.
ALL REQUESTS TO XML-RPC WEB SERVICES MUST BE ENCODED AS UTF-8. All Request Parameters must be encoded the same way that the posted data from a WWW form is encoded. That is, all values that should be encoded (i.e. <, >, ) must be replaced with a percent (%) sign followed by two hex digits. See: http://www.lookuptables.com/ for hex values on all characters. Use of iStockphoto's Web Services is subject to the TERMS OF USE which governs your use of the iStockphoto website. These terms may be amended at any time. Access to the Web Services may be revoked at anytime and without notice at the sole discretion of iStockphoto. Other applicable agreements between the Web Service user and iStockphoto may also exist. |
Table of Contents |

