Skip to content
Aziz edited this page Feb 5, 2019 · 6 revisions

API Base

The back-end is built as a REST-api service. UI is using the API so everything you can do in UI - you can do in API. And even more. Api consumes and produces applicatoin/json.

CRUD Model

Any entity in API could be:

C - Created (POST): /api/{PROJECT_ID}/{ENTITIY_TYPE} + BODY_WITH_ENTITY_WITHOUT_ID

R - Read (GET): /api/{PROJECT_ID}/{ENTITIY_TYPE}/{ENTITY_ID}

or

R - Read (GET): /api/{PROJECT_ID}/{ENTITIY_TYPE}?filters....

U - Updated (PUT): /api/{PROJECT_ID}/{ENTITIY_TYPE} + BODY_WITH_ENTITY_WITH_ID

D - Deleted (DELETE): /api/{PROJECT_ID}/{ENTITIY_TYPE}/{ENTITY_ID}

Count (GET): /api/{PROJECT_ID}/{ENTITIY_TYPE}/count?filters....

Deletion

Entities are never being deleted. On Deletion they are just being marked as deleted. This helps to restore accidentally removed entities.

Filtering and Counting

When getting entities lists and counting them - filters may apply. Filters are just query parameters that reflect entity fields.

E.g., an entity has fields: name, owner, version. It is possible to find all entities of version "1" and owner "user" performing following GET request:

/api/{PROJECT_ID}/{ENTITIY_TYPE}?version=1&owner=user

When multiple parameters of the same key are provided it will turn into an "OR" expression for the corresponding field.

E.g. - now we want to get all entities of versions "1" OR "2" and owner "user"

/api/{PROJECT_ID}/{ENTITIY_TYPE}?version=1&version=2&owner=user

Pagination

In addition to filters users can specify -

how many items to return: "skip="

and how many items to skip from the beginning: "limit=" .

E.g., lets find 20 test runs skipping 40 from the beginning with version "1": /api/{PROJECT_ID}/testrun?version=1&skip=40&limit=20

Fields Filter Prefix

Prefixes could be used for specific requests on text and numeric fields: from_NUMERICFIELD=

to_NUMERICFIELD=

like_TEXTFIELD=

E.g. - we want to find all testruns with more than 2 and less than 10 failed tests and a title containing word "fake".

/api/{PROJECT_ID}/testrun?from_status.failed=2&to_status.failed=40&like_title=fake

Clone this wiki locally