YoPlanning API

Introduction

Version: v2.0

API Versions

Current version: v2.0

API Basic URLs

API Basic URL for production: https://api.yoplanning.pro/v2.0

If you are using https://api.yoplanning.pro with no version indicator, then it means you are using precisely version v2.0, and not the last version of the API.

Authentification & Headers

Currently, all you need is to ask us for your API token. When you get it, you can use it!

You need to put ‘Authorization: Token token’ and ‘Content-Type: application/json’ in the header of your API requests, and it will be sufficient to ask our systems.

API Methods
Teams
GET /team/staffs/{team_id}
Get basic data about the given team staffs
GET /team/staffs/{team_id}

Get basic data about the given team staffs. Retrieve the staffs name, email and id for the given team.

Path variables

team_id
string required

team ID

Notes

If a staff never activated his or her account, first_name will be filled with his or her email address and last_name will be a single white space.

Responses

200 OK
Body

Note that if a staff never activated his or her account, first_name will be filled with his or her email address and last_name will be a single white space.

Object
staffs
Array
Object
email
string
Example:
john.snow@gmail.com
first_name
string
Example:
John
last_name
string
Example:
Snow
user_id
string
Example:
e5564303-1422-4390-bdc0-2d1d8492c594
phone_number
string
Example:
065588995544
is_active
boolean
Example:
true
Example > Response
{  
    "staffs":[
       { 
           "email": "john.snow@gmail.com",
           "first_name": "John",
           "last_name": "Snow", 
           "user_id": "e5564303-1422-4390-bdc0-2d1d8492c594", 
           "phone_number": "065588995544",
           "is_active": true
       },
       {
           "email": "eddard.stark@gmail.com",
           "first_name": "Eddard",
           "last_name": "Stark", 
           "user_id": "23ce4d04-5627-4297-a6d6-d34dd42e1705", 
           "phone_number": "+33674669923",
           "is_active": true
       },
       {
           "email": "sansa.stark@gmail.com",
           "first_name": "Eddard",
           "last_name": "Stark", 
           "user_id": "72a27b17-9f26-45fa-80a0-d83ac0cc6607", 
           "phone_number": null,
           "is_active": true
       },
       {
           "email": "robb.stark@hotmail.fr",
           "first_name": "robb@stark.com",
           "last_name": " ", 
           "user_id": "72a27b17-9f26-45fa-80a0-d83ac0cc6607", 
           "phone_number": null,
           "is_active": false
       }
    ]
}
Plannings
Get the planning of some staffs
GET /planning/staffs

Get the planning of some staffs.

Provides the schedules of all sessions and unavailabilities for the given staffs in the given period.

Request parameters

start_date
string required

The period start date. Format YYYY-MM-DD.

end_date
string required

The period end date. Format YYYY-MM-DD.

staff_ids
string required

The ids of all the staffs you want to retrieve.

Example:
0f849e58-7fe8-4b30-9b81-4e9b796655a5,aa319ea7-63d4-4c4d-80e8-af88de239de0

Responses

200 OK
Body
Object
staffs
Array
Object
id
string
Example:
6c0847fc-1c06-47c3-b17e-64dcf3eb0ae8
email
string
Example:
john@gmail.com
schedules
Array
Object
start_date
string
Example:
2016-12-03 19:45:00
end_date
string
Example:
2016-12-03 20:45:00
Example > Response
{  
    "staffs":[  
       {  
         "id":"6c0847fc-1c06-47c3-b17e-64dcf3eb0ae8",
         "email":"john@gmail.com",
         "schedules":[  
            {  
               "start_date":"2016-12-03 19:45:00",
               "end_date":"2016-12-03 20:45:00"
            },
            {  
               "start_date":"2016-12-04 19:30:00",
               "end_date":"2016-12-04 22:00:00"
            }
         ]
       },
       {  
         "id":"c4371c08-132c-48d2-9578-6c7c81bb3a0f",
         "email":"paul@hotmail.fr",
         "schedules":[] 
       }
    ]
}
Get the planning of all the given team members
GET /planning/team

Get the planning of all the given team members.

Provides the schedules of all sessions and unavailabilities for the given team members in the given period.

Request parameters

start_date
string required

The period start date. Format YYYY-MM-DD.

end_date
string required

The period end date. Format YYYY-MM-DD.

team_id
string required

The team id

Responses

200 OK
Body
Object
staffs
Array
Object
id
string
Example:
6c0847fc-1c06-47c3-b17e-64dcf3eb0ae8
email
string
Example:
john@gmail.com
schedules
Array
Object
start_date
string
Example:
2016-12-03 19:45:00
end_date
string
Example:
2016-12-03 20:45:00
Example > Response
{  
    "staffs":[  
       {  
         "id":"6c0847fc-1c06-47c3-b17e-64dcf3eb0ae8",
         "email":"john@gmail.com",
         "schedules":[  
            {  
               "start_date":"2016-12-03 19:45:00",
               "end_date":"2016-12-03 20:45:00"
            },
            {  
               "start_date":"2016-12-04 19:30:00",
               "end_date":"2016-12-04 22:00:00"
            }
         ]
       },
       {  
         "id":"c4371c08-132c-48d2-9578-6c7c81bb3a0f",
         "email":"paul@hotmail.fr",
         "schedules":[] 
       }
    ]
}
Products
POST /product/v1/get-products
Get products for the given team (pIdStructure)
POST /product/v1/get-products

Get products for the given team (pIdStructure).

Depending on the parameters you give, you can also retrieve availabilities.

Request body

Object
pSerialiseOn
integer
pIdStructure
string
Example:
d865dc3f-246d-4e32-956a-174653dd6e98
pLanguage
string
Example:
FRA
pParameters
string
Example:
[{"DisplayCategory":1,"DisplayProduct":1,"DisplayField":1,"DisplayAccessory":0,"DisplayDiscount":1,"DisplayAvailability":1,"CategoryIn":"","CategoryOut":"","ProductIn":"","ProductOut":"","StartDate":""}]

Responses

201 Created
Example > Request 1
Example > Request 2

Get all products

curl -X POST -H "Content-Type: application/json" -H 'Authorization: Token 9318da00d6adc0e8229809606c060c792ef65115' -d '{"pSerialiseOn"  : 0,"pIdStructure"  : "DEMOMU", "pLanguage":"FRA","pParameters":{"DisplayCategory":1,"DisplayProduct":1,"DisplayField":1,"DisplayAccessory":1,"DisplayDiscount":1,"DisplayAvailability":0,"CategoryIn":"","CategoryOut":"","ProductIn":"","ProductOut":"","StartDate":""}}' 'https://api.yoplanning.pro/product/v1/get-products'

Get available sessions for one product

curl -X POST -H "Content-Type: application/json" -H 'Authorization: Token 9318da00d6adc0e8229809606c060c792ef65198' -d '{"pSerialiseOn"  : 0,"pIdStructure"  : "DEMOMU", "pLanguage":"FRA","pParameters":{"DisplayCategory":1,"DisplayProduct":1,"DisplayField":1,"DisplayAccessory":1,"DisplayDiscount":1,"DisplayAvailability":1,"CategoryIn":"","CategoryOut":"","ProductIn":"my_product_id","ProductOut":"","StartDate":""}}' 'https://api.yoplanning.pro/product/v1/get-products'
Sessions
POST /session/{team_id}
Add a new session to the planning
POST /session/{team_id}

Add a new session to the planning. The given order will be related to some new sessions (instead of simply adding new participants in existing ones like order/{team_id} method).

Path variables

team_id
string required

Request body

Note that if you provide several dates (in the schedule list), several linked-sessions will be created.

Object
order
Object
team_id
string

REQUIRED : Will be provided to you on demand

Example:
DEMOMU
merchant_order_id
string

REQUIRED : This is your internal order id

Example:
nk0000001
payment
Object
price
Object
amount
number

REQUIRED : This is the actual price that will be payed for this order

Example:
11.5
currency
string

REQUIRED : The currency should be the same as the one chosen in your team account

Example:
EUR
payer
Object
first_name
string

REQUIRED

Example:
Jon
last_name
string

REQUIRED

Example:
Doe
company
string
email
string

REQUIRED

Example:
jon@doe.com
phone_number
string
Example:
+3366998855
mobile_number
string
Example:
+3366998855
billing_address
Object

OPTIONAL

street
string
Example:
rue de l'inconnu
city
string
Example:
Annecy
zip_code
string
Example:
74000
country
string
Example:
FR
state
string
Example:
Auvergne-Rhône-Alpes
packages
Array
Object
activities
Array
Object
session
Object
staff_ids
Array
Example:
["8ea878e1-8e05-4dcb-b00e-5121522052a7","5f36bca1-8a9c-4640-906a-4be647d6a62c"]
string
Example:
8ea878e1-8e05-4dcb-b00e-5121522052a7
team_id
string

REQUIRED

Example:
6d3caeb3-0f03-4cff-9b9d-fa19c68126e2
title_fr
string

At least 1 title (english or french) is required

Example:
Ski alpin piste rouge
title_en
string

At least 1 title (english or french) is required

Example:
Downhill skiing red slope
description_fr
string
Example:
Le but est d'apprendre les bases et de s'amuser.
description_en
string
Example:
The goal is to teach the basics and to have fun.
activity_place
string
Example:
Chamonix
meeting_point_fr
string
Example:
Next to the cable car
meeting_point_en
string
Example:
a coté du téléphérique
level
integer

The required level to participate to this session. 0: All, 1: begginer, 2: intermediate, 3: Advanced

Example:
1
target_participants
integer

0 : All, 1: Childreen, 3: Adults

utc_time_offset
integer

This correpond to your timezone. If you are in GMT +2, the value will be 120. It is preferable that you don’t hardcode this value and get it programatically due to saving times in some countries

Example:
-60
schedules
Array
Object
start_date
string

REQUIRED

Example:
2016-12-20 15:00:00
end_date
string

REQUIRED

Example:
2016-12-20 17:00:00
participants
Array
Object
first_name
string

REQUIRED

Example:
Jean
last_name
string

REQUIRED

Example:
Dupont
email
string
Example:
jean.dupont@gmail.com
birth_date
string
Example:
1970-05-04
phone_number
string
Example:
+3366998855
language
string
Example:
fr
specific_data
Array

OPTIONAL This correspond to specific data setup in the team account like weight, size, etc…

Object
id
string
Example:
0c7934fe-7c88-4e83-a1d2-b4382533894c
value
string
Example:
35
ticket
Object
price
integer

REQUIRED

Example:
50
price_variation_id
string

If the participant have a special price (member card, children, etc…), this is the id corresponding to the discount in yoplanning

Example:
5858a8ef-1102-474d-8660-029dc1a98613
accessories
Array

OPTIONAL. A list of accessories that will be provided to the participant for this activity

Object
id
string

REQUIRED

Example:
TSHIRT
quantity
integer

REQUIRED

Example:
1
price
Object
unit_price
integer

REQUIRED

Example:
30

Responses

201 Created
Body
Object
success
boolean
Example:
true
errors
Array of unknown

This field will be present only if there was an erreur. For example, you will get an error if some staff are unavailable at the time you want to create a session

Example > Request
{
    "order": {
        "team_id": "DEMOMU",
        "merchant_order_id": "nk0000001",
        "payment": {
            "price": {
                "amount": 11.50,
                "currency": "EUR"
            },
            "payer": {
                "first_name": "Jon",
                "last_name": "Doe",
                "company": "",                    
                "email": "jon@doe.com",
                "phone_number": "+3366998855",     
                "mobile_number": "+3366998855",    
                "billing_address": {             
                    "street": "rue de l'inconnu", 
                    "city": "Annecy",              
                    "zip_code": "74000",          
                    "country": "FR",              
                    "state": "Auvergne-Rhône-Alpes" 
                }
            }
        },
        "packages": [
            {
                "activities": [
                    {
                        "session" : {
                            "staff_ids" : ["8ea878e1-8e05-4dcb-b00e-5121522052a7","5f36bca1-8a9c-4640-906a-4be647d6a62c"],
                            "team_id": "6d3caeb3-0f03-4cff-9b9d-fa19c68126e2",
                            "title_fr": "Ski alpin piste rouge",
                            "title_en": "Downhill skiing red slope",
                            "description_fr": "Le but est d'apprendre les bases et de s'amuser.",
                            "description_en": "The goal is to teach the basics and to have fun.",
                            "activity_place": "Chamonix",
                            "meeting_point_fr" : "Next to the cable car",
                            "meeting_point_en": "a coté du téléphérique",
                            "level": 1,
                            "target_participants": 0,
                            "utc_time_offset": -60,
                            "schedules" : [
                                {
                                    "start_date" : "2016-12-20 15:00:00",
                                    "end_date": "2016-12-20 17:00:00"
                                }
                            ]

                        },
                        "participants": [
                            {
                                "first_name": "Jean",
                                "last_name": "Dupont",
                                "email": "jean.dupont@gmail.com", 
                                "birth_date": "1970-05-04",       
                                "phone_number": "+3366998855",    
                                "language": "fr",                 
                                "specific_data": [
                                    {
                                        "id": "0c7934fe-7c88-4e83-a1d2-b4382533894c",
                                        "value": "35"
                                    }
                                ],
                                "ticket": {
                                    "price": 50,
                                    "price_variation_id":"5858a8ef-1102-474d-8660-029dc1a98613"
                                },
                                "accessories": [
                                    {
                                        "id": "TSHIRT",
                                        "quantity": 1,
                                        "price": {
                                            "unit_price": 30
                                        }
                                    }
                                ]
                            }
                        ]
                    }
                ]
            }
        ]
    }
}
Create an order that can be paid using the returned payment url
POST /order/{team_id}

Path variables

team_id
string required

Request body

pn_url: this url will be used to notify your system that the payment have been successful. This url must accept POST request without any authentication. A good and secure way to handle this is to provide a private order id (an id that is only known by your system) in the url. Something like https://mysite/payment-success/6846551. You can use this id to retrieve which order was payed in your system. The data received will be structured like this { order_id : String. The order_id you provided when you created the order success : Boolean. Should always be True if you received this IPN. payer_lang : String. The language used by the payer when he paid (2 characters). ex : fr }

redirection_url : The payer will be redirected on this url when he clicks on “back to merchant site” after his payment.

order: A complex data structure describing the order.

You can provide any number of activities. Note that an activity without session_group_id is NOT scheduled on a specific time. Thus, the participant will be able to choose the date of its activity.

Object
ipn_url
string
Example:
https://mysite/payment-success/my-private-id
redirection_url
string
Example:
https://mysite/my-merchant-page
cancel_url
string
Example:
https://mysite/my-merchant-page/error
order
Object
team_id
string
Example:
DEMOMU
merchant_order_id
string
Example:
nk0000001
payment
Object
price
Object
amount
number
Example:
11.5
currency
string
Example:
EUR
payer
Object
first_name
string
Example:
Jon
last_name
string
Example:
Doe
company
string
email
string
Example:
jon@doe.com
phone_number
string
Example:
+3366998855
mobile_number
string
Example:
+3366998855
billing_address
Object
street
string
Example:
rue de l'inconnu
city
string
Example:
Annecy
zip_code
string
Example:
74000
country
string
Example:
FR
state
string
Example:
Auvergne-Rhône-Alpes
vendor
Object
id
string
Example:
0e12f5d1-0b5a-4d98-b504-f6297f82e8f1
packages
Array
Object
activities
Array
Object
product_id
string
Example:
6b24bcf9-bd7a-41c1-b0fe-fa39dc955a6d
session_group
Object
id
string
Example:
61f15885-c468-4ee7-9dd6-aabbc647c6f8
participants
Array
Object
first_name
string
Example:
Jean
last_name
string
Example:
Dupont
email
string
Example:
jean.dupont@gmail.com
birth_date
string
Example:
1970-05-04
phone_number
string
Example:
+3366998855
language
string
Example:
fr
specific_data
Array
Object
id
string
Example:
0c7934fe-7c88-4e83-a1d2-b4382533894c
value
string
Example:
35
ticket
Object
price
integer
Example:
50
price_variation_id
string
Example:
5858a8ef-1102-474d-8660-029dc1a98613
accessories
Array
Object
id
string
Example:
TSHIRT
quantity
integer
Example:
1
price
Object
unit_price
integer
Example:
30

Responses

201 Created
Body
Object
success
boolean
Example:
true
payment_url
string

the url that can be used to pay the order

Example:
...
Example > Request
{
    "ipn_url": "https://mysite/payment-success/my-private-id",
    "redirection_url": "https://mysite/my-merchant-page",
    "cancel_url": "https://mysite/my-merchant-page/error",
    "order": {
        "team_id": "DEMOMU",
        "merchant_order_id": "nk0000001",
        "payment": {
            "price": {
                "amount": 11.50,
                "currency": "EUR"
            },
            "payer": {
                "first_name": "Jon",
                "last_name": "Doe",
                "company": "",                    
                "email": "jon@doe.com",
                "phone_number": "+3366998855",     
                "mobile_number": "+3366998855",    
                "billing_address": {
                    "street": "rue de l'inconnu", 
                    "city": "Annecy",              
                    "zip_code": "74000",          
                    "country": "FR",              
                    "state": "Auvergne-Rhône-Alpes" 
                }
            },
            "vendor": {
                "id": "0e12f5d1-0b5a-4d98-b504-f6297f82e8f1"
            }
        },
        "packages": [
            {
                "activities": [
                    {
                        "product_id": "6b24bcf9-bd7a-41c1-b0fe-fa39dc955a6d",  
                        "session_group": {    
                            "id": "61f15885-c468-4ee7-9dd6-aabbc647c6f8"
                        },
                        "participants": [
                            {
                                "first_name": "Jean",
                                "last_name": "Dupont",
                                "email": "jean.dupont@gmail.com", 
                                "birth_date": "1970-05-04",       
                                "phone_number": "+3366998855",    
                                "language": "fr",                 
                                "specific_data": [
                                    {
                                        "id": "0c7934fe-7c88-4e83-a1d2-b4382533894c",
                                        "value": "35"
                                    },
                                ],
                                "ticket": {
                                    "price": 50,
                                    "price_variation_id":"5858a8ef-1102-474d-8660-029dc1a98613"
                                },
                                "accessories": [
                                    {
                                        "id": "TSHIRT",
                                        "quantity": 1,
                                        "price": {
                                            "unit_price": 30
                                        }
                                    }
                                ]
                            }
                        ]
                    }
                ]
            }
        ]
    }
}