Events

The /events resource provides complete control over events and allows retrieving, updating, adding, and deleting events.

Listing All Events

Request

GET /events/

Example Response

// GET /events/
 
{
  "123456": {
    "id": 123456,
    "account_id": 123456,
    "caption": "v1 Approved",
    "date": "2010-07-15T14:08:41",
    "origin": "User",
    "products": [
      "300400"
    ]
  },
  "123457": {
    "id": 123457,
    "account_id": 123456,
    "caption": "v2 Approved",
    "date": "2010-09-15T14:07:28",
    "origin": "User",
    "products": [
      "300400"
    ]
  }
}

Creating an Event

Request

POST /events/

Arguments

caption
The caption of the event
date
(yyyy-mm-dd) date for the event
products
A comma separated string of productIds

Example Response

// POST /events/
 
{
  "id": 888888,
  "account_id": id,
  "caption": "Ad Campaign",
  "date": "2010-04-12T00:00:00",
  "origin": "User",
  "products": [
     "300400",
     "300401"
  ]
}

Updating an Event

Request

PUT /events/{eventId}

Arguments

eventId
The Id of the event to update
caption
The caption of the event
date
(yyyy-mm-dd) date for the event
products
A comma separated string of productIds

Example Response

// PUT /events/5438
 
{
  "id": 543812,
  "account_id": 32109,
  "caption": "Changed Category",
  "date": "2010-04-12T00:00:00",
  "origin": "User",
  "products": [
    "300400"
  ]
}

Deleting an Event

Request

DELETE /events/{eventId}

Arguments

eventId
The ID of the event to delete

Example Response

// DELETE /events/5438
// HTTP 200
  • Anonymous

    PUT /events/{event_id}

    I guess by “Arguments”, you mean a JSON Representation of the listed arguments in the request body? Or do you expect them in the URL encoded query string? Or as Http headers?

    Supposing you expect them in JSON in the request body:

    • If I don’t supply the JSON Representation of an event (supplying the arguments you list in the docs, where btw. “details” is missing), I get a server-side NullReferenceException. 
    • If I supply a JSONified event in the body, (using “event_id” instead of “id” for the event’s id – why “event_id” here btw?)  i get a server-side ”The parameters dictionary contains a null entry for parameter ‘eventID’ of non-nullable type ‘System.Int32′ for method ‘System.Web.Mvc.ActionResult UpdateEvent(Int32, AppFiguresService.Legacy.ExternalEvent)’ in ‘AppFiguresService.Controllers.EventController’. An optional parameter must be a reference type, a nullable type, or be declared as an optional parameter.

    nParameter name: parameters”….  I’m …confused, can you help?  One more thing… Is it common practice for restful services to respond with a 200 OK http status even if it actually was a 500 Internal Server Error?