From 347453aecf31a707b3a50072df7f00cb85bc1c65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nejdet=20Kadir=20Bekta=C5=9F?= <50639655+nejdetkadir@users.noreply.github.com> Date: Tue, 17 Jan 2023 20:41:42 +0300 Subject: [PATCH] Add example requests to readme (#7) --- README.md | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/README.md b/README.md index 47339c63..49956a6e 100644 --- a/README.md +++ b/README.md @@ -69,6 +69,8 @@ Your user model is now ready to use `devise-api` gem. It will draw routes for to | sign_in_user_tokens | POST | /users/tokens/sign_in | devise/api/tokens#sign_in | | info_user_tokens | GET | /users/tokens/info | devise/api/tokens#info | +### You can look up the [example requests](#example-api-requests). + ## Configuration `devise-api` is a full configurable gem. You can configure it to your needs. Here is a basic usage example: @@ -226,6 +228,46 @@ class Api::V1::TokensController < YourBaseController end ``` +## Example API requests + +### Sign in +```curl +curl --location --request POST 'http://127.0.0.1:3000/users/tokens/sign_in' \ +--header 'Content-Type: application/json' \ +--data-raw '{ + "email": "test@development.com", + "password": "123456" +}' +``` + +### Sign up +```curl +curl --location --request POST 'http://127.0.0.1:3000/users/tokens/sign_up' \ +--header 'Content-Type: application/json' \ +--data-raw '{ + "email": "test@development.com", + "password": "123456" +}' +``` + +### Refresh token +```curl +curl --location --request POST 'http://127.0.0.1:3000/users/tokens/refresh' \ +--header 'Authorization: Bearer ' +``` + +### Revoke +```curl +curl --location --request POST 'http://127.0.0.1:3000/users/tokens/revoke' \ +--header 'Authorization: Bearer ' +``` + +### Info +```curl +curl --location --request GET 'http://127.0.0.1:3000/users/tokens/info' \ +--header 'Authorization: Bearer ' +``` + ## Development After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.