Skip to content

GraphQL API

Tomas Stenlund edited this page Feb 3, 2020 · 1 revision

Schema and interface

The GraphQL interface is located at /gql and is in GraphQL format, the content type must be application/json. The GraphQL query is sent in the body of a POST request and the response is returned in the body of the response from the REST request. The header requirement of the request is the same as for the REST API and you must be authenticated to be able to make the request.

GraphQL types and schema

enum ItemSource { Human, Machine }
enum ItemLevel { L0, L1, L2, L3, L4, L5}
enum ItemState { Unknown, Online, Offline }
enum ItemModifier { Static, Transient }
enum ItemApproval {Waiting, Approved, Denied }

type Item {
  itemId:ID
  itemName:String!
  itemGuid:String!
  itemDescription:String!
  itemSource:ItemSource!
  itemState:ItemState!
  itemLevel:ItemLevel!
  itemModifier:ItemModifier!
  itemApproval:ItemApproval!
  itemLatitude:Float!
  itemLongitude:Float!
  itemDistance:Float
  itemCreated:UTCTime!
}

queryItem(
  queryItemId:ID!
  ):Item
  
queryItems(
  queryItemsLongitude:Float
  queryItemsLatitude:Float
  queryItemsDistance:Float
  queryItemsLimit:Int
  queryItemsText:String
  ):[Item!]!

createItem(
  createItemName:String!
  createItemGuid:String!  
  createItemDescription:String!
  createItemSource:ItemSource!
  createItemState:ItemState!
  createItemLevel:ItemLevel!
  createItemModifier:ItemModifier!
  createItemApprovla:ItemApproval!
  createItemCreated:UTCTime!
  createItemLongitude:Float!
  createItemLatitude:Float!
  ):Item!
  
deleteItem(
  deleteItemId:ID!
  ):Item
  
updateItem(
  updateItemID:ID!
  updateItemName:String
  updateItemGuid:String
  updateItemDescription:String
  updateItemSource:ItemSource
  updateItemState:ItemState
  updateItemLevel:ItemLevel
  updateItemModifier:ItemModifier
  updateItemApproval:ItemApproval
  updateItemCreated:UTCTime
  updateItemLongitude:Float
  updateItemLatitude:Float
  ):Item

Clone this wiki locally