Skip to content
Youcef Korichi edited this page Nov 14, 2016 · 5 revisions

GET /watchlists

Retourne les watchlists de tous les utilisateurs. Note: C'est au développeur de filtrer s'il désire les watchlists d'un seul utilisateur.

Entrée

Token d'authentification nécessaire

Aucun paramètres

Sortie

Retourne une liste de watchlists.

[
    {
        "movies": [],
        "owner": {
            ...
        },
        "id": "558c332486916400221a0d9e"
    }
...
]

GET /watchlists/:id

Permet d'afficher la watchlist à l'id demandé.

Entrée

Token d'authentification nécessaire

Aucun paramètres

Sortie

Exemple:

{
    "movies": [],
    "owner": {
        "email": "name@mail.com",
        "name": "username",
        "id": "5678"
    },
    "id": "1234"
}

POST /watchlists

Permet de créer une nouvelle watchlist.

Entrée

Token d'authentification nécessaire

** Paramètres d'entrée **

owner est seulement nécessaire pour utilisation sans token le contentType doit etre imperativement 'application/json'

{
  "name": "Watchlist name",
  "owner": "owner@mail.com" 
}
Sortie

Exemple:

{
    "name": "Watchlist name",
    "movies": [],
    "owner": {
        ...
    },
    "id": "558c333986916400221a0d9f"
}

PUT /watchlists/:id

Permet de modifier la watchlist à l'id demandé.

Entrée

Token d'authentification nécessaire

** Paramètres d'entrée **

owner est seulement nécessaire pour utilisation sans token

{
  "name": "Watchlist name",
  "owner": "owner@mail.com",
  "movies" : []
}
Sortie

Exemple:

{
    "name": "Watchlist name",
    "movies": [],
    "id": "12345"
}

POST /watchlists/:id/movies

Permet d'ajouter un film à la watchlist correspondant à l'id demandé.

Entrée

Token d'authentification nécessaire

** Paramètres d'entrée **

Correspond à un objet movie.

        {
            "wrapperType": "track",
            "kind": "feature-movie",
            "trackId": 265727087,
            "artistName": "James Wan",
            "trackName": "Saw",
            "trackCensoredName": "Saw",
            "trackViewUrl": "https://itunes.apple.com/us/movie/saw/id265727087?uo=4",
            "previewUrl": "http://a978.v.phobos.apple.com/us/r1000/097/Video/a6/aa/f2/mzm.jszrvyyu..640x360.h264lc.D2.p.m4v",
            "artworkUrl30": "http://is5.mzstatic.com/image/pf/us/r30/Music/af/37/e2/dj.fsfobjrm.30x30-50.jpg",
            "artworkUrl60": "http://is2.mzstatic.com/image/pf/us/r30/Music/af/37/e2/dj.fsfobjrm.60x60-50.jpg",
            "artworkUrl100": "http://is2.mzstatic.com/image/pf/us/r30/Music/af/37/e2/dj.fsfobjrm.100x100-75.jpg",
            "collectionPrice": 9.99,
            "trackPrice": 9.99,
            "trackRentalPrice": 2.99,
            "collectionHdPrice": 12.99,
            "trackHdPrice": 12.99,
            "trackHdRentalPrice": 3.99,
            "releaseDate": "2004-10-29T07:00:00Z",
            "collectionExplicitness": "notExplicit",
            "trackExplicitness": "notExplicit",
            "trackTimeMillis": 6187486,
            "country": "USA",
            "currency": "USD",
            "primaryGenreName": "Horror",
            "contentAdvisoryRating": "R",
            "longDescription": "Would you die to live? That's what two men, Adam (Leigh Whannell) and Gordon (Cary Elwes), have to ask themselves when they're paired up in a deadly situation. Abducted by a serial killer, they're trapped up in a prison constructed with such ingenuity that they may not be able to escape before their captor decides it's time to dismantle their bodies in his signature way. Attempting to break free may kill them, but staying definitely will.",
            "radioStationUrl": "https://itunes.apple.com/station/idra.265727087"
        }
Sortie

Exemple:

La watchlist contiendra le nouveau film dans la liste movies.

{
    "name": "Watchlist name",
    "movies": [],
    "id": "12345"
}

DELETE /watchlists/:id/movies/:trackId

Permet de retirer le film avec l'id trackId de la watchlist correspondant à l'id id demandé.

Entrée

Token d'authentification nécessaire

** Aucun paramètres **

Sortie

Exemple:

La watchlist ne contient plus le film à l'id trackId dans la liste movies.

{
    "name": "Watchlist name",
    "movies": [],
    "id": "12345"
}

DELETE /watchlists/:id

Permet de supprimer la watchlist correspondant à l'id id demandé.

Entrée

Token d'authentification nécessaire

** Aucun paramètres **

Sortie

Exemple:

La watchlist n'existe plus.

{
    "message": "Watchlist ID deleted successfully."
}