[cc-devel] Having a problem with call to API "details"

Lisa Brooks lisa at issuelab.org
Fri Sep 17 17:43:59 EDT 2010


Hi there -

We have been using the CC API with no problems for several months.
About a week ago we started having a problem with a call to "details".

We save the URI of the CC license to our database and then use PHP and
cURL to do a post request to retrieve the appropriate text as needed.
Here's the code we've been using without a hitch for months:

[code]
function getLicenseByURI($uri) // $uri eg.
http://creativecommons.org/licenses/by-nc-nd/3.0/us/
{
   $ch = curl_init('http://api.creativecommons.org/rest/1.5/details');
   curl_setopt($ch, CURLOPT_POST, TRUE);
   curl_setopt($ch, CURLOPT_POSTFIELDS, 'license-uri=' . $uri);
   curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
   $result = curl_exec($ch);
   curl_close($ch);
   return $result;
}
[/code]

Now, rather than returning the license text, this code returns this
error message:

<error>
   <id>missingparam</id>
   <message>A value for license-uri must be supplied.</message>
</error>

I read in the instructions that "Errors occuring from either invalid
input or server-side problems are returned as an XML block, with an
<error> top level element."

If I do a get by calling up
http://api.creativecommons.org/rest/1.5/details?license-uri=http://creativecommons.org/licenses/by-nc-nd/3.0/us/
in my browser, all works fine.

I've tried changing the call to use 1.0, dev, staging -- nothing seems
to get the job done anymore.

Appreciate any help anyone can offer! Thanks!
~Lisa

Lisa M. Brooks
Co-director
IssueLab: bringing nonprofit research into focus - http://www.issuelab.org
lisa at issuelab.org
773-649-1790



More information about the cc-devel mailing list