ourresearch / total-impact-core

An api and backend code to gather the impacts of diverse scholarly products online.
http://impactstory.org
Other
55 stars 7 forks source link

How to use POST /tiid/:namespace/:namespaceid #102

Closed quantizer closed 12 years ago

quantizer commented 12 years ago

I need to get (or create) tiid for my publication url. Before changes in API I send something like this json [["url", "URL"]] to http://total-impact-core.herokuapp.com/items and it works for post method. But now this method deprecated, so I tried to use this method POST /tiid/:namespace/:namespaceid Right now it works only with GET method for example http://api.total-impact.org/tiid/url/http://liquidfuture.blogspot.com/2011/08/background-to-liquid-future.html but isn't working with POST method.

Where I can see full list of namespaces? What correct namespace for POST url?

Right now POST method returns this (command curl -i -X POST -H "Content-Type: application/json" -d '{}' http://api.total-impact.org/tiid/url/http://liquidfuture.blogspot.com/2011/08/background-to-liquid-future.html):

HTTP/1.1 405 METHOD NOT ALLOWED
Access-Control-Allow-Headers: Content-Type
Access-Control-Allow-Methods: POST, GET, OPTIONS, PUT, DELETE
Access-Control-Allow-Origin: *
Allow: HEAD, OPTIONS, GET
Content-Type: text/html
Date: Wed, 29 Aug 2012 09:19:44 GMT
Server: gunicorn/0.14.3
Content-Length: 183
Connection: keep-alive

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<title>405 Method Not Allowed</title>
<h1>Method Not Allowed</h1>
<p>The method POST is not allowed for the requested URL.</p>
hpiwowar commented 12 years ago

Sorry for the slow reply!

You are quite right, we had a bug in our docs. Rather than POSTing to /tiid, do a POST to /item instead. We've updated the docs, so hopefully everything you need now is here: http://total-impact.org/api-docs#toc_3_6

Thanks for the feedback! Heather