MarshalAPI - MikeAWilliams/white_card GitHub Wiki

Note, the apis listed do not include authentication or authorization.

marshal record

A marshal is granted privileges on the system through his or her marshal record. This api describes that record

Example

{
  "realName": "Mike Williams",
  "scaName": "Logan of Logan",
  "blueCardNumber": 123456,
  "email":"[email protected]",
  "privileges":{
    "systemAdmin": {
      "valid":true,
      "issuedBy":12345
    },
  "kingdomMarshal": [{"diciplineName":"Rapier", "issuedBy":123456}],
  "authorizingMarshal":[{"diciplineName":"Heavy", "issuedBy":223456}],
    }
}

Schema

{
  "title": "Marshal Record",
  "type": "object",
  "required": ["realName","scaName","email",
"blueCardNumber","privileges"],
  "properties": {
    "realName": {
      "type": "string",
      "description": "the marshals real name"
    },
    "scaName": {
      "type": "string",
      "description": "the marshals sca name"
    },
    "email": {
      "type": "string",
      "description": "the marshals email"
    },
    "blueCardNumber": {
      "type": "integer",
      "description": "the marshals blue card number"
    },
    "privileges": {
      "type": "object",
      "description": "A list of authorizing privileges for this user",
      "required": ["systemAdmin","kingdomMarshal","authorizingMarshal"],
      "properties": {
        "systemAdmin": {
          "type": "object",
          "required": ["valid","issuedBy"],
          "properties": {
            "valid": {
              "type": "boolean",
              "description": "is the user a valid system admin"
            },
            "issuedBy": {
              "type": "integer",
              "description": "the marshals blue card number who granted system admin"
            }
          }
        },
        "kingdomMarshal": {
          "type": "array",
          "items": {
            "type": "object",
            "required": ["diciplineName","issuedBy"],
            "properties": {
              "diciplineName": {
                "type": "string",
                "description": "the name of a dicipline for which this person is a kingdom marshal"
              },
              "issuedBy": {
                "type": "integer",
                "description": "the marshals blue card number who granted this level of kingdom marshal"
              }
            }
          }
        },
        "authorizingMarshal": {
          "type": "array",
          "items": {
            "type": "object",
            "required": ["diciplineName","issuedBy"],
            "properties": {
              "diciplineName": {
                "type": "string",
                "description": "the name of a dicipline for which this person is an authorizing marshal"
              },
              "issuedBy": {
                "type": "integer",
                "description": "the marshals blue card number who granted this authorizing marshal status"
              }
            }
          }
        }
      }
    }
  }
}

API

GET /api/v1/marshals

Description

retrieve all marshal data

Request Body

none

Response

200 Successful

{
   "marshals": [ {"All Marshal Records as above"}]
}

GET /api/v1/marshals/blueCardNumber

Description

retrieve marshal data for marshal with blueCardNumber

Request Body

none

Response

200 Successful, 404 Not found

Successful response Body

{
"A marshal data as above"
}

POST /api/v1/marshals/blueCardNumber

Description

Create a new marshal data with the provided blue card number

Request Body

{
"A marshal data as above"
}

Response

200 Successful, 403 Marshal already exists

Error response Body

{
"The existing marshal data as above"
}

PUT /api/v1/marshals/blueCardNumber

Description

Replace an existing marshal data with the one in the body for the given blueCardNumber

Request Body

{
"A marshal data as above"
}

Response

200 Successful, 404 Marshal not found

Successful response body

{
"old":"The previous existing marshal data as above",
"new":"The marshal data as in the body of the request as above"
}

DELETE /api/v1/marshals/blueCardNumber

Description

Delete the marshal associated with the blueCardNumber

Request Body

none

### Response
200 Successful, 404 Marshal not found
### Successful response body
```json
{
"The marshal record that was deleted as above",
}