Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create a event #37

Open
williamespindola opened this issue Jun 18, 2017 · 0 comments
Open

Create a event #37

williamespindola opened this issue Jun 18, 2017 · 0 comments
Milestone

Comments

@williamespindola
Copy link
Owner

williamespindola commented Jun 18, 2017

Request

POST: /event
Accept: Application/vnd.siren+json
Content-Type: Application/Json
Token: foo-bar-baz
{
  "name": "Event name",
  "user_can_update_subbect": Bool,
  "user_can_add_subbect": Bool
}

Use token to identify user and define author and user_id

Response

Status: 201 Created
Content-Type: Application/vnd.siren+json
{
  "class":  ["event"],
  "properties": {
    "_id": ObjectId("59b6ffa1fea7bb5b5768d4c0"),
    "name": "Event name",
    "created_at": ISODate("2017-09-20T12:41:39.000+0000"),
    "user_can_update_subject": Bool,
    "user_can_add_subject": Bool,
    "status": "Status name",
    "updated_at": "2016-09-09 10:10:10"
  },
  "entities": [
    {
      "class": ["user", "author"],
      "rel": [ "http://x.io/rels/user" ],
      "properties": {
        "user_id": "foo-bar-baz",
        "name": "Peter Joseph"
      },
      "links": [
        { "rel": [ "self" ], "href": "http://api.x.io/user/:userId" }
      ]
    }
  ],
  "actions" : [
    {
      "name": "edit-event",
      "title": "Edit event",
      "method": "PUT",
      "href": "http://api.x.io/event/:eventid",
      "type": "application/json",
      "fields": [
        { "name": "name", "type": "text", "value": "Event name" },
        { "name": "user_can_update_subject", "type": "bool", "value": "true" },
        { "name": "user_can_add_subject", "type": "bool", "value": "true" },
        { "name": "status", "type": "text", "value": "Status name" },
      ]
    },
    {
      "name": "delete-event",
      "title": "Delete event",
      "method": "DELETE",
      "href": "http://api.x.io/event/:eventid"
    },
  ],
  "links": [
    { "rel": ["self"], "href": "http://api.x.io/event/:eventId" }
    { "rel": ["collection"], "href": "http://api.x.io/event/:eventId/subjects" }
  ]
}

See #34 to event document definition

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant