Skip to content

Removed client application creation from the doc & improve get started with runkit example #11

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 26 additions & 10 deletions 00-getstarted.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,37 @@

The Sport Places API can help you build sport-related applications requiring sport places. Here are a few steps to get you started:

**1. Sign up as an API User to receive important communications (mandatory).**
**1. Sign up as an API User (mandatory).**

To keep our API Users happy, we will want to make sure we can inform about amazing upgrades or important changes.
To keep our API Users happy and , we will want to make sure we can inform about exciting news, improvements and breaking changes.

Sign up by filling this form: <a href="http://eepurl.com/ggGaRP" target="_blank">http://eepurl.com/ggGaRP</a>

**2. Learn how authenticate.**
<p style="color:#0082c3;">IMPORTANT<br> You will receive the intructions to create your API Client Application in the email confirmation.</p>

To get a `client_id` and `JWT Tokens`, go to [Authentication](#authentication)
**2. Make your first API Call**

**3. Make your first API Call!**
```javascript
const axios = require('axios')

You are ready to go! We suggest you make your first API Call calling the sport places around you. Let's start with [Sport Places](#sport-places).
//
// Returns all the places where you can practice tennis in Montreal
//

<aside class="notice">
If you want to have greater access to our API you must be part of our partners program,
please email <a href="mailto:[email protected]">[email protected]</a> to learn more.
</aside>
const sportPlacesBaseUrl = 'https://sportplaces.api.decathlon.com/api/v1/places'
const coordinates = '-73.582,45.511' // Montreal Coordinates
const radius = 99 // Radius in km
const sportId = 175 // Tennis Sport ID (see Sports API Documentation)

const { data } = await axios.get(`${sportPlacesBaseUrl}?origin=${coordinates}&radius=${radius}&sports=${sportId}`)

const places = data.data
```

For a quick proof of concept, we prepared this <a href="https://runkit.com/alextoul/sport-places-hello-world" target="_blank">Hello World script</a> on Runkit for you.

Output:
![Tennis place in Montreal](https://i.ibb.co/Bf0x3z5/Screen-Shot-2019-07-17-at-10-35-53-AM.png)


Nice, isn't it? For the next step, let's make your first API call calling the sport places around you. Let's start with [this concrete example](#sport-places).
18 changes: 4 additions & 14 deletions 01-authentication.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,15 @@
# Authentication

## 1. Create an API client application
## 1. Get your API client application

```shell
curl --request POST \
--url 'https://sportplaces.api.decathlon.com/api/v1/clients' \
--header 'content-type: application/json' \
--data '{"client_name":"My Client Application","redirect_uris": ["https://client.example.com/callback"]}'
```
Instructions to get your API credentials will be sent to you by email after you sign up <a href="https://mailchi.mp/decathlon/sportplacesapi" target="_blank">here</a>. If you lost them, sign up under a different email or contact us.

## 2. Obtain a JWT Token

A JWT token is required for all `POST`, `PUT/PATCH`, and `DELETE` requests.
Currently we use Auth0 to issue JWTs for third-party developers, and <a href="https://developers.decathlon.com/products" target="_blank">Decathlon Login</a> if you are part of Decathlon partner program.

All third-party developers must obtain an application `client_id` and `client_secret` issued by Auth0 via our dedicated API endpoint.
You **MUST** set your name correctly, as there is currently no way to alter it after creation.

<aside class="warning">
We are working on building a console to help you track your credentials. In the meantime, do not lose your client credentials once they are issued.
</aside>

## 2. Obtain a JWT Token

```
https://decathlon.auth0.com/authorize?
Expand Down