COLOURlovers API DocumentationLast Updated 17 February, 2009 License:Attribution-Noncommercial-Share Alike - http://creativecommons.org/licenses/by-nc-sa/3.0/ If you would like to use the API in ways outside of this license please contact us for permission. COLOURlovers APICopyright © 2008, COLOURlovers.com All rights reserved. Access to the services provided by this website and the COLOURlovers API and use of the information and services provided through the same, with or without modification, are permitted provided that the following conditions are met:
THIS WEBSITE AND THE COLOURLOVERS API IS PROVIDED BY COLOURLOVERS.COM “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL COLOURLOVERS.COM BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ![]()
Request URLs: [For Multiple Colors] http://www.colourlovers.com/api/colorshttp://www.colourlovers.com/api/colors/newhttp://www.colourlovers.com/api/colors/tophttp://www.colourlovers.com/api/colors/random [No parameters allowed]
Parameters [Case-sensitve]: lover, hueRange, briRange, keywords, keywordExact, orderCol, sortBy, numResults, resultOffset, format, jsonCallback
Example Parameters:
Requests with orderCol defined will override any /new or /top switch
Request URL: [For One Color] http://www.colourlovers.com/api/color/6B4106 - Where 6B4106 is any 6-char hex value
Parameters [Case-sensitve]: format, jsonCallback
Example Parameters:
Example Result:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<colors> <color> <id>903893</id> <title><![CDATA[wet dirt]]></title> <userName><![CDATA[jessicabrown]]></userName> <numViews>0</numViews> <numVotes>0</numVotes> <numComments>0</numComments> <numHearts>0</numHearts> <rank>903853</rank> <dateCreated>2008-03-17 11:22:21</dateCreated> <hex>6B4106</hex> <rgb> <red>107</red> <green>65</green> <blue>6</blue> </rgb> <hsv> <hue>35</hue> <saturation>94</saturation> <value>42</value> </hsv> <description><![CDATA[]]></description> <url><![CDATA[http://www.colourlovers.com/color/6B4106/wet_dirt]]></url> <imageUrl><![CDATA[http://www.colourlovers.com/img/6B4106/100/100/wet_dirt.png]]></imageUrl> <badgeUrl><![CDATA[http://www.colourlovers.com/images/badges/c/903/903893_wet_dirt.png]]></badgeUrl> <apiUrl>http://www.colourlovers.com/api/color/6B4106</apiUrl> </color> </colors> JSON formatted results contain the above data in JSON format [how's that for redundancy?]
Breakdown of API xml:
![]()
Request URLs: [For Multiple Palettes] http://www.colourlovers.com/api/paletteshttp://www.colourlovers.com/api/palettes/newhttp://www.colourlovers.com/api/palettes/tophttp://www.colourlovers.com/api/palettes/random [No parameters allowed]
Parameters [Case-sensitve]: lover, hueOption, hex, keywords, keywordExact, orderCol, sortBy, numResults, resultOffset, format, jsonCallback, showPaletteWidths
Example Parameters:
Requests with orderCol defined will override any /new or /top switch
Request URL: [For One Palette] http://www.colourlovers.com/api/palette/113451 - Where 113451 is an interger and a valid paletteID
Parameters [Case-sensitve]: format, jsonCallback, showPaletteWidths
Example Parameters:
Example Result:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<palettes> <palette> <id>12345</id> <title><![CDATA[be my boy]]></title> <userName><![CDATA[sinta schneider]]></userName> <numViews>1052</numViews> <numVotes>37</numVotes> <numComments>13</numComments> <numHearts>4.5</numHearts> <rank>1</rank> <dateCreated>2008-03-01 16:19:21</dateCreated> <colors> <hex>423238</hex> <hex>F5DE8C</hex> <hex>C8D197</hex> <hex>B3702D</hex> <hex>EB2138</hex> </colors> <!-- Optional color widths [Only returned with the ?showPaletteWidths=1] --> <colorWidths>0.2,0.2,0.2,0.2,0.2</colorWidths> <description><![CDATA[]]></description> <url><![CDATA[http://www.colourlovers.com/palette/293826/be_my_boy]]></url> <imageUrl><![CDATA[http://www.colourlovers.com/paletteImg/423238/F5DE8C/C8D197/B3702D/EB2138/be_my_boy.png]]></imageUrl> <badgeUrl><![CDATA[http://www.colourlovers.com/images/badges/p/293/293826_be_my_boy.png]]></badgeUrl> <apiUrl>http://www.colourlovers.com/api/palette/293826</apiUrl> </palette> </palettes> JSON formatted results contain the above data in JSON format [how's that for redundancy?]
Breakdown of API xml:
![]()
Request URLs: [For Multiple Patterns] http://www.colourlovers.com/api/patternshttp://www.colourlovers.com/api/patterns/newhttp://www.colourlovers.com/api/patterns/tophttp://www.colourlovers.com/api/patterns/random [No parameters allowed]
Parameters [Case-sensitve]: lover, hueOption, hex, keywords, keywordExact, orderCol, sortBy, numResults, resultOffset, format, jsonCallback
Example Parameters:
Requests with orderCol defined will override any /new or /top switch
Request URL: [For One Pattern] http://www.colourlovers.com/api/pattern/1451 - Where 1451 is an interger and a valid patternID
Parameters [Case-sensitve]: format, jsonCallback
Example Parameters:
Example Result:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<patterns> <pattern> <id>12345</id> <title><![CDATA[Tenderness.]]></title> <userName><![CDATA[not.an.am.person]]></userName> <numViews>617</numViews> <numVotes>32</numVotes> <numComments>14</numComments> <numHearts>4.5</numHearts> <rank>1</rank> <dateCreated>2008-03-01 06:43:38</dateCreated> <colors> <hex>C6C5AC</hex> <hex>CDB89F</hex> <hex>D4AA93</hex> <hex>B8E0C5</hex> <hex>BFD3B8</hex> </colors> <description><![CDATA[]]></description> <url><![CDATA[http://www.colourlovers.com/pattern/49471/Tenderness.]]></url> <imageUrl><![CDATA[http://colourlovers.com.s3.amazonaws.com/images/patterns/49/49471.png]]></imageUrl> <badgeUrl><![CDATA[http://www.colourlovers.com/images/badges/n/49/49471_Tenderness..png]]></badgeUrl> <apiUrl>http://www.colourlovers.com/api/pattern/49471</apiUrl> </pattern> </patterns> JSON formatted results contain the above data in JSON format [how's that for redundancy?]
Breakdown of API xml:
![]()
Request URLs: [For Multiple Lovers] http://www.colourlovers.com/api/lovershttp://www.colourlovers.com/api/lovers/newhttp://www.colourlovers.com/api/lovers/top
Parameters [Case-sensitve]: orderCol, sortBy, numResults, resultOffset, format, jsonCallback
Example Parameters:
Requests with orderCol defined will override any /new or /top switch
Request URL: [For One Lover] http://www.colourlovers.com/api/lover/COLOURlover - Where COLOURlover is a valid COLOURlovers.com Username
Parameters [Case-sensitve]: comments, format, jsonCallback
Example Parameters:
Example Result:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<lovers> <lover> <id>12345</id> <userName><![CDATA[electrikmonk]]></userName> <dateRegistered>2005-08-07 6:45:47</dateRegistered> <dateLastActive>2008-03-16 21:02:01</dateLastActive> <rating>554159</rating> <location><![CDATA[#FF0000stick, LA, US]]></location> <numColors>3,498</numColors> <numPalettes>2,775</numPalettes> <numPatterns>36</numPatterns> <numCommentsMade>7,201</numCommentsMade> <numLovers>710</numLovers> <numCommentsOnProfile>672</numCommentsOnProfile> <!-- Optional comments [Only returned when viewing one Lover with the ?comments=1] --> <comments> <comment> <commentDate>2008-03-10 05:10:58</commentDate> <commentUserName><![CDATA[mashedpotato]]></commentUserName> <commentComments><![CDATA[you are so awesome. :x ]]></commentComments> </comment> </comments> <url><![CDATA[http://www.colourlovers.com/lover/electrikmonk]]></url> <apiUrl><![CDATA[http://www.colourlovers.com/api/lover/electrikmonk]]></apiUrl> </lover> </lovers> JSON formatted results contain the above data in JSON format [how's that for redundancy?]
Breakdown of API xml:
![]()
Request URLs: http://www.colourlovers.com/api/stats/colorshttp://www.colourlovers.com/api/stats/paletteshttp://www.colourlovers.com/api/stats/patternshttp://www.colourlovers.com/api/stats/lovers
Parameters [Case-sensitve]: format, jsonCallback
Example Parameters:
Example Result:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<stats> <total>1500563</total> </stats> JSON formatted results contain the above data in JSON format [how's that for redundancy?]
Breakdown of API xml:
![]()
<?php
$curl = curl_init(); curl_setopt($curl,CURLOPT_URL,"http://www.colourlovers.com/api/colors/new"); curl_setopt($curl,CURLOPT_HEADER,false); curl_setopt($curl,CURLOPT_RETURNTRANSFER,true); $xml = curl_exec($curl); curl_close($curl); header("Content-Type: text/xml; charset=utf-8"); echo $xml; ?> ![]()
Example Provided by Rob Shaw at www.projectpods.com
<cfset variables.baseurl = "http://www.colourlovers.com/api/">
<cffunction name="getTopPatterns" access="public" returntype="array"> <cfargument name="numberResults" type="numeric" default="20"> <cfscript> var aPattern = arrayNew(1); var x = 0; var j = 0; var result = ""; var xmlResult = ""; </cfscript> <cfhttp url="#variables.baseurl#/patterns/top" result="result"> <cfhttpparam type="formfield" name="numResults" value="#arguments.numberResults#" /> </cfhttp> <cfscript> xmlResult = xmlparse(result.fileContent); </cfscript> <cfloop index="x" from="1" to="#arrayLen(xmlresult.patterns.pattern)#"> <cfscript> aPattern[x] = structNew(); aPattern[x].id = xmlresult.patterns.pattern[x].id.xmltext; aPattern[x].title = xmlresult.patterns.pattern[x].title.xmltext; aPattern[x].description = xmlresult.patterns.pattern[x].description.xmltext; aPattern[x].patternUrl = xmlresult.patterns.pattern[x].imageUrl.xmltext; aPattern[x].colors = arrayNew(1); aPattern[x].hexCount = arrayLen(xmlresult.patterns.pattern[x].colors.hex); for (j=1;j lte aPattern[x].hexCount;j=j+1) { aPattern[x].colors[j] = xmlresult.patterns.pattern[x].colors.hex[j].xmlText; } </cfscript> </cfloop> <cfreturn aPattern> </cffunction> ![]()
If you would like to contribute source code in your language of choice on how to call COLOURlovers' API, please send us your code along with your consent to use it! Be sure to let us know who to thank, too!
|
Advertise on COLOURlovers via The Deck
![]() ![]() ![]() |
![]() |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||






![EXAMPLE API CODE [PHP]](http://static.colourlovers.com/images/v3/api/exampleApiCodePhpHeader.png)
![EXAMPLE API CODE [CFML]](http://static.colourlovers.com/images/v3/api/exampleApiCodeCfmlHeader.png)
![EXAMPLE API CODE [INSERT LANGUAGE HERE]](http://static.colourlovers.com/images/v3/api/exampleApiCodeInsertLanguageHereHeader.png)







