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

Nathan Yergler nathan at creativecommons.org
Sun Sep 19 16:02:02 EDT 2010


Hi Lisa,

First, egads, sorry that you're having trouble. It appears from the
code snippet and what you describe that the main difference between
the calls that work and don't (from the browser and from your code)
are GET vs. POST.  This leads me to believe that this is a bug we
introduced on our end.

We recently were facing some performance issues, so enabled caching
for calls where that makes sense. I'm sure details was one of those
(since when doing a GET, the result is the same no matter what). I
suspect that for some reason the POST payload isn't making it through.
Sigh.

Nathan Kinkade (cc'd), can you look at the Varnish configuration and
make sure POST calls to the API are getting passed through directly to
the API?

Thanks,

Nathan


On Fri, Sep 17, 2010 at 2:43 PM, Lisa Brooks <lisa at issuelab.org> wrote:
> 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
> _______________________________________________
> cc-devel mailing list
> cc-devel at lists.ibiblio.org
> http://lists.ibiblio.org/mailman/listinfo/cc-devel
>



More information about the cc-devel mailing list