mozilla / api.webmaker.org

Services for Webmaker
https://api.webmaker.org
17 stars 14 forks source link

Design Project API #6

Closed cadecairos closed 9 years ago

cadecairos commented 9 years ago
xmatthewx commented 9 years ago

Can we make it possible to remix a single page within a project? The goal: lower the bar for participation and increase activity on the platform.

cadecairos commented 9 years ago

Can we make it possible to remix a single page within a project? The goal: lower the bar for participation and increase activity on the platform.

see #7

cadecairos commented 9 years ago

Also,

xmatthewx commented 9 years ago

see #7

:boom:

thisandagain commented 9 years ago

I suggest we make /projects a sub-resource of /users/:user as it makes cache invalidation quite a bit easier and also properly reflects the ownership of the resource ala: /users/:user/projects.

thisandagain commented 9 years ago

I don't see anything in the designs that require sorting or retrieval of page data that would prohibit another HTTP request. Pagination seems like a requirement anywhere where the API is returning an array.

davidascher commented 9 years ago

We need localized searches, no? "Show recent/featured projects for this locale?" "show recent/featured projects near this latlong?"

thisandagain commented 9 years ago

We don't have any features / UX for geolocation yet, just locale at this point.

cadecairos commented 9 years ago

@thisandagain we could have /users/:user/projects and also have /projects which defaults to listing either the authenticated user's projects, or the default list of public project data.

thisandagain commented 9 years ago

@cadecairos That's true ... I like the idea of having /projects be a raw feed of all public projects. Having /projects list only the authenticated user's projects seems awfully non-restful and difficult to cache.

thisandagain commented 9 years ago

Here is a crack at another sketch:

API

GET /projects – List of all projects (both featured and not featured)

GET /users/:user/projects – List of all projects from the specified user
POST /users/:user/projects – Create a new project
GET /users/:user/projects/:project – Get an existing project by ID
PUT /users/:user/projects/:project – Update an existing project by ID (auth, owner)
DEL /users/:user/projects/:project – Delete an existing project by ID (auth, owner)

GET /users/:user/projects/:project/remixes – Get all remixes of an existing project by ID
POST /users/:user/projects/:project/remixes – Create a new remix of an existing project by ID
^ this last resource seems weird / wrong

Data Model

{
    "id": 1,
    "version": "1.0.2",
    "title": "Yam Fries 4000",
    "featured": true,
    "history": {
        "created_at": "2015-04-20T16:11:13.961Z",
        "updated_at": "2015-04-20T16:11:13.961Z",
        "deleted_at": null,
    },
    "thumbnail": {
        "400": "https://blah.storage.com/some/image.jpg",
        "1024": "https://blah.storage.com/some/image.jpg"
    }
}
cadecairos commented 9 years ago

POST /users/:user/projects/:project/remixes – Create a new remix of an existing project by ID ^ this last resource seems weird / wrong

the basis for that was https://developer.github.com/v3/repos/forks/#create-a-fork

thisandagain commented 9 years ago

Cool. Works for me! Thanks for the reference.