This repository was archived by the owner on Dec 17, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 35
Projects Resource
ashley williams edited this page Jun 12, 2015
·
1 revision
API Documentation
The Project resource is represented in the database as such:
{
id: <Type.Integer.unique>
title: <Type.String.unique>
user_id: <Type.Integer> // The foreign key of the User object the Project belongs to
date_updated: <Type.String>
date_created: <Type.String>
description: <Type.String>
tags: <Type.String>
}
Creates a new Project object.
Expects a request.payload with the following attribtues:
-
title* -
user_id* -
date_created* -
date_updated* descriptiontags
* = required
Example:
{
title: "endpoints",
user_id: 1,
date_created: "2015-06-03T13:21:58+00:00",
date_updated: "2015-06-03T13:21:58+00:00", //will be the same as date_created
description: "a json-api compliant hypermedia framework for NodeJS",
tags: "node,REST,hypermedia,api,json-api"
}
Retrieves a collection of Project objects.
Example response:
[
{
"id": 1,
"user_id": 1,
"title": "spacecats-API",
"tags": "sinatra, api, REST, server, ruby",
"description": "Venture a very small stage in a vast cosmic arena Euclid billions upon billions!",
"date_created": "2015-06-03T13:21:58+00:00",
"date_updated": "2015-06-03T13:21:58+00:00"
},
{
"id": 2,
"user_id": 1,
"title": "sinatra-contrib",
"tags": "ruby, sinatra, community, utilities",
"description": "Hydrogen atoms Sea of Tranquility are creatures of the cosmos shores of the cosmic ocean.",
"date_created": "2015-06-03T13:21:58+00:00",
"date_updated": "2015-06-03T13:21:58+00:00"
},
{
"id": 3,
"user_id": 2,
"title": "webmaker-android",
"tags": "android, mobile, social",
"description": "Gathered by gravity encyclopaedia galactica permanence of the stars made in the interiors of collapsing stars! ",
"date_created": "2015-06-03T13:21:58+00:00",
"date_updated": "2015-06-03T13:21:58+00:00"
},
{
"id": 4,
"user_id": 3,
"title": "makedrive",
"tags": "web",
"description": "Orions sword a still more glorious dawn awaits at the edge of forever consciousness, cosmic fugue Vangelis, globular star cluster.",
"date_created": "2015-06-03T13:21:58+00:00",
"date_updated": "2015-06-03T13:21:58+00:00"
}
]
Retrieves a single Project object.
Example response:
// GET /projects/1
{
"id": 1,
"user_id": 1,
"title": "spacecats-API",
"tags": "sinatra, api, REST, server, ruby",
"description": "Venture a very small stage in a vast cosmic arena Euclid billions upon billions!",
"date_created": "2015-06-03T13:21:58+00:00",
"date_updated": "2015-06-03T13:21:58+00:00"
}
PUT /projects/{id}
Updates a Project object based on its id attribute. The representation that is passed will replace the current representation of the object, so the full representation should be passed, alongside any changes.
Expects a request.payload containing:
titleuser_iddate_createddate_updateddescriptiontags
For example:
// PUT /projects/4
{
title: "my cool framework",
user_id: 1,
date_created: "2015-06-03T13:21:58+00:00",
date_updated: "2015-06-03T13:21:58+00:00", //will be the same as date_created
description: "a json-api compliant hypermedia framework for NodeJS",
tags: "node,REST,hypermedia,api,json-api"
}
DELETE /projects/{id}
Deletes a Project object based on its id attribute.