API for the @acmpdx
HTTP method | Description |
---|---|
GET | To view a resource(s) |
PUSH | To add a resource |
POST | To update/change a resource |
DELETE | To delete/remove a resource |
$ curl http://acm.pdx.edu/api/v1/
{
"events_url": [
"http://acm.pdx.edu/api/v1/events/"
"http://acm.pdx.edu/api/v1/events/<int:event_id>"
],
"memberships_url": [
"http://acm.pdx.edu/api/v1/memberships/",
"http://acm.pdx.edu/api/v1/memberships/<int:membership_id>"
],
"officerships_url": [
"http://acm.pdx.edu/api/v1/officerships/",
"http://acm.pdx.edu/api/v1/officerships/<int:officership_id>"
],
"people_url": [
"http://acm.pdx.edu/api/v1/people/",
"http://acm.pdx.edu/api/v1/people/<int:person_id>",
"http://acm.pdx.edu/api/v1/people/<int:editor_id>",
"http://acm.pdx.edu/api/v1/people/<string:username>"
],
"posts_url": [
"http://acm.pdx.edu/api/v1/posts/"
"http://acm.pdx.edu/api/v1/posts/<int:post_id>"
]
}
$ curl http://acm.pdx.edu/api/v1/people/ \
-u root:1234 \
-d username="foobar" \
-d name="Foo Bar" \
-d email="[email protected]" \
-d password="password1234"
{
"email": "[email protected]",
"id": 2,
"name": "Foo Bar",
"username": "foobar",
"website": null,
}
$ curl http://acm.pdx.edu/api/v1/people/ \
-u root:1234 \
-d username="war5"
-d password="password1234"
{
"email": null,
"id": 2,
"name": null,
"username": "war5",
"website": null,
}
$ curl -X PUT http://acm.pdx.edu/api/v1/people/war5 \
-u root:1234 \
-d name="Billy Bob"
{
"email": null,
"id": 2,
"name": "Billy Bob",
"username": "war5",
"website": null
}
$ curl -X PUT http://acm.pdx.edu/api/v1/people/war5 \
-u root:1234 \
-d email="[email protected]"
{
"email": "[email protected]",
"id": 2,
"name": "Billy Bob",
"username": "war5",
"website": null
}
$ curl http://acm.pdx.edu/api/v1/people/
[
{
"email": null,
"id": 1,
"name": "Foo Bar",
"username": "foobar",
"website": null
},
{
"email": "[email protected]",
"id": 2,
"name": "Billy Bob",
"username": "war5",
"website": null
}
]
$ curl http://acm.pdx.edu/api/v1/people/1
{
"email": null,
"id": 1,
"name": "Foo Bar",
"username": "foobar",
"website": null
}
$ curl http://acm.pdx.edu/api/v1/people/foobar
{
"email": null,
"id": 1,
"name": "Foo Bar",
"username": "foobar",
"website": null
}
$ curl -X DELETE http://acm.pdx.edu/api/v1/people/foobar \
-u root:1234
{
"message": "delete successful"
}
$ curl -X DELETE http://acm.pdx.edu/api/v1/people/1 \
-u root:1234
{
"message": "delete successful"
}
$ curl http://acm.pdx.edu/api/v1/memberships/ \
-u root:1234 \
-d person_id=1 \
-d start_date="2014-10-11" \
-d end_date="2015-10-11"
{
"end_date": "2015-10-11",
"id": 1,
"person": "http://acm.pdx.edu/api/v1/people/1",
"person_id": 1,
"start_date": "2014-10-11"
}
$ curl http://acm.pdx.edu/api/v1/memberships/
[
{
"end_date": "2015-10-11",
"id": 1,
"person": "http://acm.pdx.edu/api/v1/people/1",
"person_id": 1,
"start_date": "2014-10-11"
}
]
$ curl http://acm.pdx.edu/api/v1/memberships/1
{
"end_date": "2015-10-11",
"id": 1,
"person": "http://acm.pdx.edu/api/v1/people/1",
"person_id": 1,
"start_date": "2014-10-11"
}
$ curl -X DELETE http://acm.pdx.edu/api/v1/memberships/1 \
-u root:1234
{
"message": "delete successful"
}
$ curl http://acm.pdx.edu/api/v1/officerships/ \
-u root:1234 \
-d person_id=1 \
-d title="Vice Chair" \
-d start_date="2014-10-11" \
-d end_date="2015-10-11"
{
"end_date": "2015-10-11",
"id": 1,
"person": "http://acm.pdx.edu/api/v1/people/1",
"person_id": 1,
"start_date": "2014-10-11",
"title": "Vice Chair"
}
$ curl http://acm.pdx.edu/api/v1/officerships/
[
{
"end_date": "2015-10-11",
"id": 1,
"person": "http://acm.pdx.edu/api/v1/people/1",
"person_id": 1,
"start_date": "2014-10-11",
"title": "Vice Chair"
}
]
$ curl http://acm.pdx.edu/api/v1/officerships/1
{
"end_date": "2015-10-11",
"id": 1,
"person": "http://acm.pdx.edu/api/v1/people/1",
"person_id": 1,
"start_date": "2014-10-11",
"title": "Vice Chair"
}
$ curl -X DELETE http://acm.pdx.edu/api/v1/officerships/1 \
-u root:1234
{
"message": "delete successful"
}
$ curl http://acm.pdx.edu/api/v1/events/ \
-u root:1234 \
-d title="Event Title 1" \
-d description="Event 1" \
-d location="Room 1" \
-d speaker="Bob" \
-d start="2014-10-10 20:20:00.00000" \
-d end="2014-10-10 21:10:00.00000"
{
"canceled": false,
"description": "Event 1",
"edited_at": "Mon, 21 Apr 2014 04:12:35 -0000",
"editor": "http://acm.pdx.edu/api/v1/people/1",
"editor_id": 1,
"end": "Fri, 10 Oct 2014 21:10:00 -0000",
"event_id": 1,
"hidden": false,
"location": "Room 1",
"revision": 1,
"speaker": "Bob",
"start": "Fri, 10 Oct 2014 20:20:00 -0000",
"title": "Event Title 1"
}
$ curl http://acm.pdx.edu/api/v1/events/ \
-u root:1234 \
-d title="Event Title 2" \
-d description="Event 2" \
-d location="Room 2" \
-d speaker="Alex" \
-d start="2014-11-10 20:20:00.00000" \
-d end="2014-11-10 21:10:00.00000"
{
"canceled": false,
"description": "Event 2",
"edited_at": "Mon, 21 Apr 2014 04:14:42 -0000",
"editor": "http://acm.pdx.edu/api/v1/people/1",
"editor_id": 1,
"end": "Mon, 10 Nov 2014 21:10:00 -0000",
"event_id": 2,
"hidden": false,
"location": "Room 2",
"revision": 1,
"speaker": "Alex",
"start": "Mon, 10 Nov 2014 20:20:00 -0000",
"title": "Event Title 2"
}
$ curl -X PUT http://acm.pdx.edu/api/v1/events/1 -d canceled=True \
-u root:1234 \
{
"canceled": true,
"description": "Event 1",
"edited_at": "Mon, 21 Apr 2014 04:16:35 -0000",
"editor": "http://acm.pdx.edu/api/v1/people/1",
"editor_id": 1,
"end": "Fri, 10 Oct 2014 21:10:00 -0000",
"event_id": 1,
"hidden": false,
"location": "Room 1",
"revision": 2,
"speaker": "Bob",
"start": "Fri, 10 Oct 2014 20:20:00 -0000",
"title": "Event Title 1"
}
$ curl http://acm.pdx.edu/api/v1/events/
[
{
"canceled": true,
"description": "Event 1",
"edited_at": "Mon, 21 Apr 2014 04:16:35 -0000",
"editor": "http://acm.pdx.edu/api/v1/people/1",
"editor_id": 1,
"end": "Fri, 10 Oct 2014 21:10:00 -0000",
"event_id": 1,
"hidden": false,
"location": "Room 1",
"revision": 2,
"speaker": "Bob",
"start": "Fri, 10 Oct 2014 20:20:00 -0000",
"title": "Event Title 1"
},
{
"canceled": false,
"description": "Event 2",
"edited_at": "Mon, 21 Apr 2014 04:14:42 -0000",
"editor": "http://acm.pdx.edu/api/v1/people/1",
"editor_id": 1,
"end": "Mon, 10 Nov 2014 21:10:00 -0000",
"event_id": 2,
"hidden": false,
"location": "Room 2",
"revision": 1,
"speaker": "Alex",
"start": "Mon, 10 Nov 2014 20:20:00 -0000",
"title": "Event Title 2"
}
]
$ curl http://acm.pdx.edu/api/v1/events/1
[
{
"canceled": false,
"description": "Event 1",
"edited_at": "Mon, 21 Apr 2014 04:12:35 -0000",
"editor": "http://acm.pdx.edu/api/v1/people/1",
"editor_id": 1,
"end": "Fri, 10 Oct 2014 21:10:00 -0000",
"event_id": 1,
"hidden": false,
"location": "Room 1",
"revision": 1,
"speaker": "Bob",
"start": "Fri, 10 Oct 2014 20:20:00 -0000",
"title": "Event Title 1"
},
{
"canceled": true,
"description": "Event 1",
"edited_at": "Mon, 21 Apr 2014 04:16:35 -0000",
"editor": "http://acm.pdx.edu/api/v1/people/1",
"editor_id": 1,
"end": "Fri, 10 Oct 2014 21:10:00 -0000",
"event_id": 1,
"hidden": false,
"location": "Room 1",
"revision": 2,
"speaker": "Bob",
"start": "Fri, 10 Oct 2014 20:20:00 -0000",
"title": "Event Title 1"
}
]
$ curl http://acm.pdx.edu/api/v1/posts/ \
-u root:1234 \
-d title="This is the Title" \
-d description="This is the description" \
-d content="This is the content"
{
"content": "This is the content",
"description": "This is the description",
"edited_at": "Mon, 21 Apr 2014 04:26:59 -0000",
"editor": "http://acm.pdx.edu/api/v1/people/1",
"editor_id": 1,
"hidden": false,
"post_id": 1,
"revision": 1,
"title": "This is the Title"
}
$ curl http://acm.pdx.edu/api/v1/posts/ \
-u root:1234 \
-d title="This is another Title" \
-d description="This is another description" \
-d content="This is some more content"
{
"content": "This is some more content",
"description": "This is another description",
"edited_at": "Mon, 21 Apr 2014 04:29:07 -0000",
"editor": "http://acm.pdx.edu/api/v1/people/1",
"editor_id": 1,
"hidden": false,
"post_id": 2,
"revision": 1,
"title": "This is another Title"
}
$ curl -X PUT http://acm.pdx.edu/api/v1/posts/1 -d canceled=True \
-u root:1234
{
"content": "This is the content",
"description": "This is the description",
"edited_at": "Mon, 21 Apr 2014 04:30:12 -0000",
"editor": "http://acm.pdx.edu/api/v1/people/1",
"editor_id": 1,
"hidden": false,
"post_id": 1,
"revision": 2,
"title": "This is the Title"
}
$ curl http://acm.pdx.edu/api/v1/posts/
[
{
"content": "This is the content",
"description": "This is the description",
"edited_at": "Mon, 21 Apr 2014 04:30:12 -0000",
"editor": "http://acm.pdx.edu/api/v1/people/1",
"editor_id": 1,
"hidden": false,
"post_id": 1,
"revision": 2,
"title": "This is the Title"
},
{
"content": "This is some more content",
"description": "This is another description",
"edited_at": "Mon, 21 Apr 2014 04:29:07 -0000",
"editor": "http://acm.pdx.edu/api/v1/people/1",
"editor_id": 1,
"hidden": false,
"post_id": 2,
"revision": 1,
"title": "This is another Title"
}
]
$ curl http://acm.pdx.edu/api/v1/posts/1
[
{
"content": "This is the content",
"description": "This is the description",
"edited_at": "Mon, 21 Apr 2014 04:26:59 -0000",
"editor": "http://acm.pdx.edu/api/v1/people/1",
"editor_id": 1,
"hidden": false,
"post_id": 1,
"revision": 1,
"title": "This is the Title"
},
{
"content": "This is the content",
"description": "This is the description",
"edited_at": "Mon, 21 Apr 2014 04:30:12 -0000",
"editor": "http://acm.pdx.edu/api/v1/people/1",
"editor_id": 1,
"hidden": false,
"post_id": 1,
"revision": 2,
"title": "This is the Title"
}
]