mirror of
https://github.com/neocities/neocities.git
synced 2025-04-24 17:22:35 +02:00
add documentation for /api/key
This commit is contained in:
parent
9f8afbd18e
commit
6e873a0778
2 changed files with 25 additions and 2 deletions
|
@ -202,7 +202,7 @@ def api_error(status, error_type, message)
|
|||
end
|
||||
|
||||
def api_error_invalid_auth
|
||||
api_error 403, 'invalid_auth', 'invalid credentials - please check your username and password'
|
||||
api_error 403, 'invalid_auth', 'invalid credentials - please check your username and password (or your api key)'
|
||||
end
|
||||
|
||||
def api_not_found
|
||||
|
|
|
@ -177,6 +177,29 @@ var api = new neocities('YOURUSERNAME', 'YOURPASSWORD')
|
|||
api.info('madamfrp', function(resp) {
|
||||
console.log(resp)
|
||||
})</code></pre>
|
||||
|
||||
|
||||
|
||||
<h2>GET /api/key</h2>
|
||||
<p>
|
||||
Returns an API key that you can use for the API instead of login credentials.
|
||||
It will automatically generate a new API key if one doesn't exist yet for your site.
|
||||
</p>
|
||||
<h3>Examples</h3>
|
||||
<h6>Using cURL</h6>
|
||||
<pre><code class="bash">$ curl "https://USER:PASS@neocities.org/api/key"
|
||||
{
|
||||
"result": "success",
|
||||
"api_key": "da77c3530c30593663bf7b797323e48c"
|
||||
}</code></pre>
|
||||
|
||||
<p>Using the api key for requests:</p>
|
||||
|
||||
<pre><code class="bash">$ curl -H "Authorization: Bearer da77c3530c30593663bf7b797323e48c" \
|
||||
https://neocities.org/api/info</code></pre>
|
||||
|
||||
<h2>Need something the API doesn't provide?</h2>
|
||||
<p>If the API does not supply something you need, <a href="/contact">contact us</a> and we will try to add it!
|
||||
<p>
|
||||
If the API does not supply something you need, <a href="/contact">contact us</a> and we will try to add it!
|
||||
</p>
|
||||
</div>
|
||||
|
|
Loading…
Add table
Reference in a new issue