Skip to content

Commit

Permalink
Add example requests to readme (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
nejdetkadir authored Jan 17, 2023
1 parent 0a3cdad commit 347453a
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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 <refresh_token>'
```

### Revoke
```curl
curl --location --request POST 'http://127.0.0.1:3000/users/tokens/revoke' \
--header 'Authorization: Bearer <access_token>'
```

### Info
```curl
curl --location --request GET 'http://127.0.0.1:3000/users/tokens/info' \
--header 'Authorization: Bearer <access_token>'
```

## 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.
Expand Down

0 comments on commit 347453a

Please sign in to comment.