Docs are incomplete. For the most thorough explanation of the routes, please visit the tests in the repo. Below are the most common use-cases of the API. If you need help or are having trouble with the API, please feel free to email to me.


Generating a private token

To have full access to editing and adding tokens, you must the bearer token provided to you via the login route. This token should never be shared publicly with others. Read below for creating and using public tokens if you would like to share your bookmarks or use them on a static site.

Generating a private token is the same thing as logging yourself into a local session on this site. You can generate one by logging in like that or via the API.

POST /auth/local/login
$ curl -d '{"email": "email", "password": "password"}' -H "Authorization: Bearer <token>" -H "Content-Type: application/json" -X POST https://api.chrona.io/auth/local/login
> {
    "archived": false,
    "id": <id>,
    "createdAt": "2019-05-11T13:33:01.560Z",
    "updatedAt": "2019-05-11T13:33:01.560Z",
    "email": <email>,
    "encryptedPassword": <encrypted password>,
    "token": <token>
  }

Public Tokens

To generate a public token, POST a new one using your Bearer token for authorization. The id of the token that is returned is the token itself that can be passed as query parameter toonly GET /bookmarks.

POST /public_tokens
$ curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer <token>" https://api.chrona.io/public_tokens
> {
    "archived": false,
    "id": "b71519d3-7a27-4950-a63b-0235116910fb",
    "createdAt": "2019-05-11T13:23:34.991Z",
    "updatedAt": "2019-05-11T13:23:34.991Z",
}

Bookmarks

Access your bookmarks with either your private token or public token. Both examples are shown below, notice that the the second does not take in the bearer token.

GET /bookmarks
$ curl -X GET -H "Authorization: Bearer <token>" https://api.chrona.io/bookmarks
> [{
    "archived": false,
    "id": "4ed9d45b-d775-4490-a15a-1f7aef316d28",
    "createdAt": "2019-05-11T13:23:34.991Z",
    "updatedAt": "2019-05-11T13:23:34.991Z",
    "title": "Making Sense of React Hooks",
    "description": "One of Dan Abramov's first blog posts on hooks",
    "href": "https://medium.com/@dan_abramov/making-sense-of-react-hooks-fdbde8803889"
  },
  {
    "archived": false,
    "id": "5cde22d7-36c8-4db2-95ea-60464b182765",
    "createdAt": "2019-05-11T13:23:34.991Z",
    "updatedAt": "2019-05-11T13:23:34.991Z",
    "title": "A Conspiracy To Kill IE6",
    "description": "Awesome story",
    "href": "http://blog.chriszacharias.com/a-conspiracy-to-kill-ie6"
 }]
GET /bookmarks?publicToken={publicToken}
$ curl -X GET https://api.chrona.io/bookmarks?publicToken={publicToken}
> [{
"archived": false,
"id": "4ed9d45b-d775-4490-a15a-1f7aef316d28",
"createdAt": "2019-05-11T13:23:34.991Z",
"updatedAt": "2019-05-11T13:23:34.991Z",
"title": "Making Sense of React Hooks",
"description": "One of Dan Abramov's first blog posts on hooks",
"href": "https://medium.com/@dan_abramov/making-sense-of-react-hooks-fdbde8803889"
},
{
"archived": false,
"id": "5cde22d7-36c8-4db2-95ea-60464b182765",
"createdAt": "2019-05-11T13:23:34.991Z",
"updatedAt": "2019-05-11T13:23:34.991Z",
"title": "A Conspiracy To Kill IE6",
"description": "Awesome story",
"href": "http://blog.chriszacharias.com/a-conspiracy-to-kill-ie6"
}]
POST /bookmarks
$ curl -d '{"title": "Making Sense of React Hooks", "href": "https://medium.com/@dan_abramov/making-sense-of-react-hooks-fdbde8803889", "description": "One of Dan Abramov'''s first blog posts on hooks"}' -H "Authorization: Bearer <token>" -H "Content-Type: application/json" -X POST https://api.chrona.io/bookmarks
> {
    "archived": false,
    "id": "4ed9d45b-d775-4490-a15a-1f7aef316d28",
    "createdAt": "2019-05-11T13:23:34.991Z",
    "updatedAt": "2019-05-11T13:23:34.991Z",
    "title": "Making Sense of React Hooks",
    "description": "One of Dan Abramov's first blog posts on hooks",
    "href": "https://medium.com/@dan_abramov/making-sense-of-react-hooks-fdbde8803889"
  }