diff --git a/docs/src/api.md b/docs/src/api.md new file mode 100644 index 0000000..ee23f5a --- /dev/null +++ b/docs/src/api.md @@ -0,0 +1,30 @@ +# API Support + +Pinry support API accessing via token so that you could write your own client or import any pin format to your instance. + +# Get Token +Just go to `My -> Profile` page to get the token. + +![token-accessing](./imgs/screenshots/token-access.png) + +# Access API via Token + +Here is an example for curl to access `user-profile` API: + + curl -X GET http://192.168.1.101:8080/api/v2/profile/users/ -H 'Authorization: Token fa3b0ed2b8a87c81323688c288642288c9570aca' + +You will get response like this: + + [ + { + "username": "winkidney", + "token": "fa3b0ed2b8a87c81323688c288642288c9570aca", + "email": "winkidney@gmail.com", + "gravatar": "0d7161ac663cdb21108502cd4051149c", + "resource_link": "http://localhost:8000/api/v2/profile/users/1/" + } + ] + + +# API reference +Just use the interactive API interface by DRF or follow the file [api.js](https://github.com/pinry/pinry/blob/master/pinry-spa/src/components/api.js) diff --git a/docs/src/imgs/screenshots/token-access.png b/docs/src/imgs/screenshots/token-access.png new file mode 100644 index 0000000..f6546dc Binary files /dev/null and b/docs/src/imgs/screenshots/token-access.png differ diff --git a/mkdocs.yml b/mkdocs.yml index 8135da6..1198fb8 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -19,6 +19,7 @@ nav: - Theories: 'theories.md' - Install with Docker: 'install-with-docker.md' - Development: 'development.md' + - API support: 'api.md' - Plugin System: 'plugin-system.md' - Upgrade Guide: 'upgrade-guide.md' - Docs: 'docs.md'