diff --git a/app/api.rb b/app/api.rb index d3370fa4..18036eba 100644 --- a/app/api.rb +++ b/app/api.rb @@ -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 diff --git a/views/api.erb b/views/api.erb index e93dcc5f..d0a25451 100644 --- a/views/api.erb +++ b/views/api.erb @@ -177,6 +177,29 @@ var api = new neocities('YOURUSERNAME', 'YOURPASSWORD') api.info('madamfrp', function(resp) { console.log(resp) }) + + + +
+ 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. +
+$ curl "https://USER:PASS@neocities.org/api/key"
+{
+ "result": "success",
+ "api_key": "da77c3530c30593663bf7b797323e48c"
+}
+
+ Using the api key for requests:
+ +$ curl -H "Authorization: Bearer da77c3530c30593663bf7b797323e48c" \
+https://neocities.org/api/info
+
If the API does not supply something you need, contact us and we will try to add it! +
+ If the API does not supply something you need, contact us and we will try to add it! +