API Documentation - niz-ka/io-project GitHub Wiki

API Reference

Scenario

POST /api/scenario

Read scenario and return it as response

Parameters

  • scenario (required) - scenario passed in request body

Response

Code Description
200 Returns scenario identical to passed in POST request
405 Method not allowed
415 Content-type header is not application/json

Example

curl -v -X POST -H 'Content-type: application/json' http://localhost:8080/api/scenario -d @scenario.json

Keywords

POST /api/scenario/keywords

Count keywords in scenario

Parameters

  • scenario (required) - scenario passed in request body

Response

Code Description
200 Returns keywords count message with number of keywords in scenario
405 Method not allowed
415 Content-type header is not application/json

Example

curl -v -X POST -H 'Content-type: application/json' http://localhost:8080/api/scenario/keywords -d @scenario.json

Steps

POST /api/scenario/steps

Count steps in scenario

Parameters

  • scenario (required) - scenario passed in request body

Response

Code Description
200 Returns steps count message with number of steps in scenario
405 Method not allowed
415 Content-type header is not application/json

Actors

POST /api/scenario/actors

Get invalid steps without actors at the beginning

Parameters

  • scenario (required) - scenario passed in request body

Response

Code Description
200 Returns steps count message with number of steps in scenario
405 Method not allowed
415 Content-type header is not application/json

Example

curl -v -X POST -H 'Content-type: application/json' http://localhost:8080/api/scenario/actors -d @scenario.json

Query

POST /api/scenario/query?actor={$actor}

Get steps by specified filter

Parameters

  • scenario (required) - scenario passed in request body
  • actor - actor passed in query string

Response

Code Description
200 Returns steps count message with number of steps in scenario
405 Method not allowed
415 Content-type header is not application/json

Example

curl -X POST -H 'Content-type: application/json' http://localhost:8080/api/scenario/query?actor=System -d @scenario.json

Models

Scenario Model

{
  "title": "Dodanie książki", (string)
  "actors": [
    "Bibliotekarz" (string)
  ],
  "systemActors": [
    "System" (string)
  ],
  "steps": [
    {
      "name": "Wyświetla się fomularz", (string)
      "childrenSteps": null (array|null)
    },
    {
      "name": "IF: Bibliotekarz pragnie dodać egzemplarz książki", (string)
      "childrenSteps": [
        {
          "name": "Bibliotekarz wybiera opcję definiowania egzemplarzy", (string)
          "childrenSteps": null (array|null)
        },
        {
          "name": "System prezentuje zdefiniowane egzemplarze", (string)
          "childrenSteps": null (array|null)
        }
      ]
    }
  ]
}

Keywords Count

{
  "keywords": 0, (integer)
}

Steps Count

{
  "numberOfSteps": 0, (integer)
}

Invalid steps

{
  "steps": [
    {
      "name": "Wyświetla się fomularz", (string)
      "childrenSteps": null (array|null)
    }
  ]
}