It looks like you're offline.
Open Library logo

Open Library RESTful API → Diff

Added
Modified
Removed
Not changed
Revision 12 by Anand Chitipothu May 11, 2010
Revision 21 by jachamp September 1, 2023
m edit
body
0 <style type="text/css"> 0 <style type="text/css">
... ...
5 5
6 * [[#content|Content]] 6 <ul>
7 * [[#query|Query]] 7  <li><a href="#content">Content</a></li>
8 * [[#history|History]] 8  <li><a href="#query">Query</a></li>
9 * [[#save|Save]] 9  <li><a href="#history">History</a></li>
10 * [[#status_codes|Status Codes]] 10  <li><a href="#recent_changes">Recent Changes</a></li>
11  <li><a href="#login">Login</a></li>
12  <li><a href="#save">Save</a></li>
13  <li><a href="#status_codes">Status Codes</a></li>
14 </ul>
11 11
... ...
22    } 22    }
23    $ curl -s -H 'Accept: application/json' http://openlibrary.org/books/OL1M 27    $ curl -s -H 'Accept: application/json' https://openlibrary.org/books/OL1M
24    { 24    {
... ...
38 38
39    $ curl http://openlibrary.org/books/OL6807502M.rdf 43    $ curl https://openlibrary.org/books/OL6807502M.rdf
40    <rdf:Description rdf:about="http://openlibrary.org/books/OL6807502M"> 40    <rdf:Description rdf:about="http://openlibrary.org/books/OL6807502M">
... ...
54    </rdf:RDF> 54    </rdf:RDF>
55    $ curl -H 'Accept: application/rdf+xml' http://openlibrary.org/books/OL6807502M.rdf 59    $ curl -H 'Accept: application/rdf+xml' https://openlibrary.org/books/OL6807502M.rdf
56    <rdf:Description rdf:about="http://openlibrary.org/books/OL6807502M"> 56    <rdf:Description rdf:about="http://openlibrary.org/books/OL6807502M">
... ...
66 66
71 Open Library also allows accessing editions of a work and works of an author using a simple URL format.
72
73    $ curl 'http://openlibrary.org/works/OL27258W/editions.json?limit=5'
74    {
75        "size": 19,
76        "links": {
77            "self": "/works/OL27258W/editions.json?limit=5",
78            "work": "/works/OL27258W",
79            "next": "/works/OL27258W/editions.json?limit=5&offset=5"
80        },
81        "entries": [{
82            "key": "/books/OL17987798M",
83            "title": "Neuromantiker",
84            ...
85        }, ...]
86    }
87
88    $ curl http://openlibrary.org/authors/OL1A/works.json
89    {
90        "size": 16,
91        "links": {
92            "self": "/authors/OL1A/works.json",
93            "author": "/authors/OL1A"}
94        },
95        "entries": [{
96            "key": "/works/OL14930760W",
97            "title": "Satchidananda Raut Roy",
98            ...
99        }, ...]
100    }
67     67    
... ...
82    ] 82    ]
83    $ curl -H 'Accept: application/json' 'http://openlibrary.org/query?type=/type/edition&authors=/authors/OL1A' 117    $ curl -H 'Accept: application/json' 'https://openlibrary.org/query?type=/type/edition&authors=/authors/OL1A'
84    [ 84    [
... ...
90        }, 90        },
125        ...
126    ]    
127    $ curl 'http://openlibrary.org/query.json?type=/type/edition&works=/works/OL2040129W'
128    [
129        {
130            "key": "/books/OL9770407M"
131        },
132        {
133            "key": "/books/OL21857767M"
134        },
91        ... 91        ...
... ...
150 150
151 *Please note that this API should not be used for bulk downloads.* Dumps of the entire data are provided at regular intervals and they can be used for bulk access. 195 *Please note that this API should not be used for bulk downloads.* [[/developers/dumps|Dumps of all data]] are provided at regular intervals and they should be used for bulk access.
152 152
... ...
166    ] 166    ]
167    $ curl -H 'Accept: application/json' http://openlibrary.org/books/OL1M?m=history 211    $ curl -H 'Accept: application/json' https://openlibrary.org/books/OL1M?m=history
168    [ 168    [
... ...
198 198
243 <a name="recent_changes">&nbsp;</a>
199 ## Recent Changes 199 ## Recent Changes
... ...
210    ] 210    ]
211    $ curl -H 'Accept: application/json' http://openlibrary.org/recentchanges 256    $ curl -H 'Accept: application/json' https://openlibrary.org/recentchanges
212    [ 212    [
... ...
227 227
228 <a name="login">&nsbp;</a> 273 <a name="login">&nbsp;</a>
229 ## Login 274 ## Login
230 275
231 To login to Open Library programatically, a POST request must be send to `/account/login` with `username` and `password` must be passed as a JSON dictionary. 276 To login to Open Library programatically, a POST request must be send to `/account/login.json` with your S3 `access` and `secret` keys passed as a JSON dictionary.
232 277
233    $ curl -i -H 'Content-Type: application/json' -d '{"username": "joe", "password": "secret"}' http://openlibrary.org/account/login 278    $ curl -i -H 'Content-Type: application/json' -d '{"access": "your access key", "secret": "your secret key"}' https://openlibrary.org/account/login
234    HTTP/1.1 200 OK 279    HTTP/1.1 200 OK
235    Set-Cookie: session="/user/joe%2C2009-02-19T07%3A52%3A13%2C74fc6%24811f4c2e5cf52ed0ef83b680ebed861f"; Path=/ 280    Set-Cookie: session="/user/username%2C2009-02-19T07%3A52%3A13%2C74fc6%24811f4c2e5cf52ed0ef83b680ebed861f"; Path=/
236     281    
237 Upon successful login, a set-cookie header is returned in the response. 282 Upon successful login, a set-cookie header is returned in the response. Include this cookie with subsequent requests.
283
284 Every Open Library account holder has S3 keys. You can find yours <a href="https://archive.org/account/s3.php">here</a>.
238 238
... ...
273 Debug information about the error may be provided in the response to help trouble-shooting the issue. 273 Debug information about the error may be provided in the response to help trouble-shooting the issue.