more docs

This commit is contained in:
Your Name 2024-06-16 13:25:26 -04:00 committed by Henri Dickson
parent 11d0787eef
commit e4e4862d78
4 changed files with 15 additions and 11 deletions

View file

@ -1,5 +1,7 @@
# API # API
## Endpoints
NeoDB has a set of API endpoints mapping to its functions like marking a book or listing collections, they can be found in swagger based API documentation at `/developer/` of your running instance, [a version of it](https://neodb.social/developer/) is available on our flagship instance. NeoDB has a set of API endpoints mapping to its functions like marking a book or listing collections, they can be found in swagger based API documentation at `/developer/` of your running instance, [a version of it](https://neodb.social/developer/) is available on our flagship instance.
NeoDB also supports a subset of Mastodon API, details can be found in [Mastodon API documentation](https://docs.joinmastodon.org/api/). NeoDB also supports a subset of Mastodon API, details can be found in [Mastodon API documentation](https://docs.joinmastodon.org/api/).
@ -8,7 +10,7 @@ Both set of APIs can be accessed by the same access token.
## How to authorize ## How to authorize
0. Create an application ### Create an application
you must have at least one URL included in the Redirect URIs field, e.g. `https://example.org/callback`, or use `urn:ietf:wg:oauth:2.0:oob` if you don't have a callback URL. you must have at least one URL included in the Redirect URIs field, e.g. `https://example.org/callback`, or use `urn:ietf:wg:oauth:2.0:oob` if you don't have a callback URL.
@ -33,19 +35,19 @@ and save of the `client_id` and `client_secret` returned in the response:
``` ```
1. Guide your user to open this URL ### Guide your user to open this URL
``` ```
https://neodb.social/oauth/authorize?response_type=code&client_id=CLIENT_ID&redirect_uri=https://example.org/callback&scope=read+write https://neodb.social/oauth/authorize?response_type=code&client_id=CLIENT_ID&redirect_uri=https://example.org/callback&scope=read+write
``` ```
2. Once authorizated by user, it will redirect to `https://example.org/callback` with a `code` parameter: ### Once authorizated by user, it will redirect to `https://example.org/callback` with a `code` parameter:
``` ```
https://example.org/callback?code=AUTH_CODE https://example.org/callback?code=AUTH_CODE
``` ```
3. Obtain access token with the following POST request: ### Obtain access token with the following POST request:
``` ```
curl https://neodb.social/oauth/token \ curl https://neodb.social/oauth/token \
@ -66,7 +68,7 @@ and access token will be returned in the response:
} }
``` ```
4. Use the access token to access protected endpoints like `/api/me` ### Use the access token to access protected endpoints like `/api/me`
``` ```
curl -H "Authorization: Bearer ACCESS_TOKEN" -X GET https://neodb.social/api/me curl -H "Authorization: Bearer ACCESS_TOKEN" -X GET https://neodb.social/api/me

View file

@ -16,6 +16,9 @@ if you are doing debug or development:
- NEODB_DEBUG - True will turn on debug for both neodb and takahe, turn off relay, and reveal self as debug mode in nodeinfo (so peers won't try to run fedi search on you) - NEODB_DEBUG - True will turn on debug for both neodb and takahe, turn off relay, and reveal self as debug mode in nodeinfo (so peers won't try to run fedi search on you)
- NEODB_IMAGE - the docker image to use, `neodb/neodb:edge` for the main branch - NEODB_IMAGE - the docker image to use, `neodb/neodb:edge` for the main branch
## Settings for Federating
- `DISABLE_DEFAULT_RELAY` is set to `False` by default, the server will send and receive public posts from `relay.neodb.net`. `relay.neodb.net` is [open sourced](https://github.com/neodb-social/neodb-relay) and operated by NeoDB developers, it works like most ActivityPub relays except it only relays between NeoDB instances, it helps public information like catalogs and trends flow between NeoDB instances. You may set it to `True` if you don't want to relay public posts with other NeoDB instances.
## Settings for Scrapers ## Settings for Scrapers

View file

@ -38,11 +38,10 @@ class Comment {
} }
Content <|-- Note Content <|-- Note
class Note { class Note {
+str text +str title
+int position +str content
+enum position_type +enum progress_type
+str quotation +str progress_value
+Image image
} }
Content <|-- Reply Content <|-- Reply

@ -1 +1 @@
Subproject commit d280504f93b0c0203a0d7a5ccea1004f39bc18f9 Subproject commit 3f3f1ee9929f9086aecd15f5e023988f26d1ccef