Events Endpoints - fullphat/snarl_network_protocol GitHub Wiki

Overview

These endpoints allow applications to create and delete event classes within a particular application.

Contents

Usage

GET endpoints do not require authentication, and use the application's Guid as the resource identifier. You can find the application's Guid by calling GET /apps.

POST and DELETE endpoints require the application's password (if one was specified during registration) to be included in the request oxide-password header. These methods also require the application's identifier - as opposed to its Guid - to be used as the resource identifier.

GET /events/{Guid}

Returns a list of Event objects associated with the application specified by Guid.

Authentication

Not required.

Request Body

Not required.

Response

UPDATE REQUIRED

Code Likely cause
OK Specified events were added or updated successfully.
400 Incorrectly formatted data or at least one event object missing an event-id parameter
401 Transport authentication or application password protection mismatch
NotFound The application specified in AppId isn't registered

Notes

  • Unlike other endpoints, this endpoint uses the application's Guid, not it's identifier.

POST /events/{AppId}

Adds or updates one or more events to the application specified by AppId. If a particular event already exists, it will be updated with any new information provided.

Authentication

If a password was specified when the application was registered, the same password must be included in the oxide-password header of the request.

Request Body

Must be a list of one or more Event objects contains details of the events to create or update.

Response

Code Likely cause
OK Specified events were added or updated successfully.
400 Incorrectly formatted data or at least one event object missing an event-id parameter
401 Transport authentication or application password protection mismatch
NotFound The application specified in AppId isn't registered

Notes

  • For requests containing multiple events, the response Reason will contain details of how many events were successfully updated or created.

Example

Request

POST /v2/events/foo/

Body

[
  {
    "Id": "bar",
    "Name": "Bar",
    "Enabled": false,
  },
  {
    "Id": "bar2",
    "Name": "Bar2",
    "Enabled": true,
  },
  {
    "Id": "foo",
    "Name": "Foo",
  },
  {
    "Id": "foo2",
  },
]

Response

{
  "Meta": {
    "Code": 200,
    "Text": "OK",
    "Reason": "4 of 4 event(s) created or updated",
    "Timestamp": "2018-05-01T17:07:16.9044786+01:00",
    "Host": "cs30",
    "Platform": "Win32NT",
    "PlatformVersion": "6.1.7601.65536"
  },
  "Data": null
}

DELETE /events/{AppId}/{EventId}

Removes the event with {event-id} from registration {app-id}.

Required Arguments

Name Description
app-id The application identifier to retrieve information on.
event-id The event identifier to retrieve information on.

Optional Arguments

None.

Response

N.

Possible reasons for failure include:

  • N

Example

x

{
  "success": {
    "app-id": "my app"
  }
}