Menu
shell
  • Introduction
  • Authentication
  • Errors
  • Partners
  • Contributing
  • Roadmap
  • Introduction

    The Decathlon Partners API can be used by any developer worldwide to obtain details of our Partners who are specialized in certain sports. This data is primarily sourced from Decathlon's global network of sport experts and our beloved friends.

    An API key is only required when modifying data - something we plan to restrict to Decathlon employees only. No key is needed to read data.

    Introduction

    The Decathlon Partners API can be used by any developer worldwide to obtain details of communities where certain sports can be practiced. This data is primarily sourced from Decathlon's global network of sport experts.

    Currently this API is for INTERNAL USE ONLY until we've fully completed our authorization controls in conjunction with the Decathlon Connect team in France 🇫🇷.

    An API key is only required when modifying data - something we plan to restrict to Decathlon employees only. No key is needed to read data.

    Authentication

    curl "https://partners-decathlon.herokuapp.com/api/v1/partners"
      -H "Authorization: Bearer XXXXXX"
    

    GET requests do not require authentication.

    Usage of this API depends on authentication with the Decathlon Connect API with OAuth2, a JWT token is used for all POST, PUT, and DELETE requests.

    GET requests do not require a token nor API key.

    Errors

    The Communities API uses the following error codes:

    Error Code Meaning
    400 Bad Request -- Your request is invalid - check the JSON format of your request.
    401 Unauthorized -- Your API key is wrong.
    404 Not Found -- The specified community wasn't found.
    422 Unprocessable Entity -- There was a validation error with your request.
    500 Internal Server Error -- We had a problem with our server. Try again later.

    Partners

    Search for Partners

    curl "https://partners-decathlon.herokuapp.com/api/v1/partners"
    

    JSON response:

    {
      "title": "Running Group",
      "source": "meetup",
      "description": null,
      "link": "http://meetup.com/runninggroupMTL",
      "featured": true,
      "partner": false,
      "city": "Montreal",
      "country": "Canada",
      "lat": "45.522938",
      "lng": "-73.581507",
      "radius": 10,
      "province": "QC",
      "image_ref": null,
      "uuid": "1cf32619-eb83-488d-bbf0-2a72b7f8fd79",
      "user_id": 0,
      "sports": [
        { "sport": 123 },
        { "sport": 456 },
        { "sport": 789 }
      ]
    }
    
    

    This endpoint retrieves all partners meeting specific criteria

    HTTP Request

    GET https://partners-decathlon.herokuapp.com/api/v1/partners

    Query Parameters

    Most parameters are optional.

    Coordinates ( lat, lng) are comma separated string representations of geographic locations.

    Search query errors will be responded to with specific error information, and an HTTP 422 status code.

    Parameter Example Description
    sport 175 Filters results based on Decathlon Sport ID
    nearby[] '45.91,-73,58' The current location of the end-user making the request. Used to calculate proximity.
    featured true Boolean representing whether a partner should be featured or not
    partner false Boolean representing whether a partner is a Décathlon partner
    page 1 For performance reasons, results are paginated by 25 items per page

    Adding Communities

    curl
      -X POST
      -H "Content-Type: application/json"
      -d "@data.json"
      https://partners-decathlon.herokuapp.com/api/v1/partners
    

    JSON request [@data.json]

    {
      "partner": {
        "title": "hello",
        "featured": false,
        "partner": false,
        "link": "http://example.com",
        "source": "google",
        "lat": 45.522938,
        "lng": -73.581507,
        "city": "Montreal",
        "province": "QC",
        "country": "CA",
        "description": "lorem ipsum dolor amet sit...",
        "sports_attributes": [
          { "sport": 123 },
          { "sport": 789 }
        ]
      }
    }
    

    This endpoint creates partners based on a Sport ID.

    HTTP Request

    POST https://partners-decathlon.herokuapp.com/api/v1/partners

    Request Parameters

    user_id, title, source, link, lat, lng and the sport_attributes array are mandatory.

    country accepts a 2-letter country code according to the ISO 3166-1 alpha 2 standard

    The sport_attributes must carry at least 1 sport.

    Updating/Editing Communities

    curl
      -X PUT
      -H "Content-Type: application/json"
      -d "@data.json"
      https://partners-decathlon.herokuapp.com/api/v1/partners/:partner_id
    

    JSON request [@data.json]

    {
      "partner": {
        "title": "Updated Title"
      }
    }
    

    This endpoint updates partners parameters.

    HTTP Request

    POST https://partners-decathlon.herokuapp.com/api/v1/partners/:partner_id

    JSON response

    
    {
      "partner": {
        "title": "Updated Title",
        "featured": false,
        "partner": false,
        "link": "http://example.com",
        "source": "google",
        "lat": "45.522938",
        "lng": "-73.581507",
        "city": "Montreal",
        "province": "QC",
        "country": "CA",
        "description": "lorem ipsum dolor amet sit...",
        "sports_attributes": [
          { "sport": 123 },
          { "sport": 789 }
        ]
      }
    }
    

    Errors

    Errors will be responded to with specific error information, and an HTTP 422 status code.

    Contributing

    Everyone is encouraged to help improve this project.

    Here are some ways you can contribute:

    Submitting a Pull Request

    1. Fork/Clone the Repository
    2. Create a [new-feature] branch
    3. Implement your feature or bug fix.
    4. Add, commit, and push your changes.
    5. Submit a Pull Request through Gitlab's UI.

    Roadmap

    1.0

    1.1

    1.2