api

package
v1.0.285 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 3, 2018 License: MIT Imports: 7 Imported by: 8

README

API server information

API path Description
/ Redirects to the /UI path (and the web based user interface)
/config/get Gets a single configuration item
/config/set Sets (creates or updates) a configuration item
/config/remove Removes a configuration item
/config/getall Gets all configuration items
/config/getallforapp Get all configuration items for a single application (plus the default * application)
/applications/getall Get all applications
Requests

Most API operations expect a configitem object in the POST body that will be used to either filter (in a get operation), update or create (in a set operation), or remove an item (in a remove operation).

For example:

{
    "application" : "AccountingReports",
    "name": "ShowObscureFactoids",
    "value": "true"
}
Responses

All operations will return an object that contain the fields status, message, and data.

For Example:

{
  "status": 200,
  "message": "Config item found",
  "data": {
    "id": 6,
    "application": "AccountingReports",
    "machine": "",
    "name": "ShowFooterDates",
    "value": "true",
    "updated": "2016-08-11T14:49:38.1555535-04:00"
  }
}
/config/get

This operation retrieves a single configuration item. If it doesn't exist for the given application, it attemps to get it for the default application (*).

This is an HTTP POST request

Example request:
{
    "application" : "AccountingReports",
    "name" : "ShowFooterDates" 
}
Example response:
{
  "status": 200,
  "message": "Config item found",
  "data": {
    "id": 6,
    "application": "AccountingReports",
    "machine": "",
    "name": "ShowFooterDates",
    "value": "true",
    "updated": "2016-08-11T14:49:38.1555535-04:00"
  }
}
/config/set

This operation sets the value of a single configuration item

This is an HTTP POST request

Example request:
{
    "application" : "AccountingReports",
    "name" : "ShowHeaderValues",
    "value": "false"
}
Example response:
{
  "status": 200,
  "message": "Config item updated",
  "data": {
    "id": 10,
    "application": "AccountingReports",
    "machine": "",
    "name": "ShowHeaderValues",
    "value": "false",
    "updated": "2016-08-11T14:58:16.0132648-04:00"
  }
}
/config/remove

This operation removes a single configuration item

Example request:
{
    "application" : "AccountingReports",
    "name" : "ShowHeaderValues"
}
Example response:
{
  "status": 200,
  "message": "Config item removed",
  "data": {
    "id": 0,
    "application": "AccountingReports",
    "machine": "",
    "name": "ShowHeaderValues",
    "value": "",
    "updated": "0001-01-01T00:00:00Z"
  }
}
/config/getall

This operation retrieves all configuration items.

This is a GET request.

Example response:
{
  "status": 200,
  "message": "Config items found",
  "data": [
    {
      "id": 7,
      "application": "AccountingReports",
      "machine": "",
      "name": "Name",
      "value": "Accounting reporting system",
      "updated": "2016-08-11T14:50:17.3451641-04:00"
    },
    {
      "id": 6,
      "application": "AccountingReports",
      "machine": "",
      "name": "ShowFooterDates",
      "value": "true",
      "updated": "2016-08-11T14:49:38.1555535-04:00"
    },
    {
      "id": 8,
      "application": "ITSupportDesk",
      "machine": "",
      "name": "ShowEmailLinks",
      "value": "false",
      "updated": "2016-08-11T14:50:51.4152237-04:00"
    },
    {
      "id": 9,
      "application": "ITSupportDesk",
      "machine": "",
      "name": "SupportNumber",
      "value": "1 (415) 344-3200",
      "updated": "2016-08-11T14:52:53.4456194-04:00"
    }
  ]
}
/config/getallforapp

This operation retrieves all configuration items for a specified application

This is an HTTP POST operation

Example request:
{
    "application" : "AccountingReports"
}
Example response:
{
  "status": 200,
  "message": "Config items found",
  "data": [
    {
      "id": 7,
      "application": "AccountingReports",
      "machine": "",
      "name": "Name",
      "value": "Accounting reporting system",
      "updated": "2016-08-11T14:50:17.3451641-04:00"
    },
    {
      "id": 6,
      "application": "AccountingReports",
      "machine": "",
      "name": "ShowFooterDates",
      "value": "true",
      "updated": "2016-08-11T14:49:38.1555535-04:00"
    }
  ]
}
/applications/getall

This operation retrieves all applications

This is an HTTP GET operation.

Example response:
{
  "status": 200,
  "message": "Applications found",
  "data": [
    "AccountingReports",
    "AnotherApp",
    "DouglasAdams",
    "FormBuilder",
    "ITSupportDesk",
    "SomeOtherAppEntirely"
  ]
}

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	WsHub = NewHub()
)

Functions

func GetAllApplications added in v1.0.49

func GetAllApplications(rw http.ResponseWriter, req *http.Request)

Gets all applications

func GetAllConfig added in v1.0.24

func GetAllConfig(rw http.ResponseWriter, req *http.Request)

Gets all config information

func GetAllConfigForApp added in v1.0.49

func GetAllConfigForApp(rw http.ResponseWriter, req *http.Request)

Gets all config information for a given application

func GetConfig

func GetConfig(rw http.ResponseWriter, req *http.Request)

Gets a specfic config item based on application and config item name

func RemoveConfig added in v1.0.28

func RemoveConfig(rw http.ResponseWriter, req *http.Request)

Removes a specific config item

func SetConfig added in v1.0.24

func SetConfig(rw http.ResponseWriter, req *http.Request)

Set a specific config item

func ShowUI added in v1.0.37

func ShowUI(rw http.ResponseWriter, req *http.Request)

Types

type Hub added in v1.0.163

type Hub struct {

	// Inbound messages from the connections.
	Broadcast chan []byte
	// contains filtered or unexported fields
}

func NewHub added in v1.0.163

func NewHub() *Hub

type WsHandler added in v1.0.163

type WsHandler struct {
	H *Hub
}

func (WsHandler) ServeHTTP added in v1.0.163

func (wsh WsHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL