AI Servers

This chapter focuses on services for the AI servers.

get Get all AI servers

A GET to /ai-servers returns all the AI servers.

HTTP request

GET /api/rest/latest/ai-servers HTTP/1.1
Accept: application/json
Host: localhost:8080

Request parameters

Parameter Description

page

number of the page to retrieve (optional)

size

size of the page to retrieve (optional)

sort

which attributes of the returned entities should be sorted on (optional)

fields

which fields of the elements should be returned (optional)

type

which type of the element should be returned (optional)

HTTP response

HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 2914

{
  "_embedded" : {
    "ai-servers" : [ {
      "id" : 3,
      "name" : "first ai server",
      "url" : "https://openai.com/",
      "description" : "a description of the usage and destination of this server",
      "payload_template" : "{\"model\": \"gpt-4-1106-preview\", \"messages\": [{\"role\": \"user\", \"content\": \"You are a manual tester. You must transform a requirement into one or several test cases, written in English. The description of the test case must consist of a sum up of the given requirement. Your answer must have this format : \"{\"testCases\":[{\"name\":\"\",\"description\":\"\",\"prerequisites\":\"\",\"testSteps\":[{\"index\":0,\"action\":\"\",\"expectedResult\":\"\"}]}]\"{{ requirement }}\"}] ,\"temperature\": 0.9, \"top_p\": 0.9, \"n\": 1, \"stream\": false, \"max_tokens\": 2000, \"presence_penalty\": 0, \"frequency_penalty\": 0}",
      "json_path" : "choices[0].message.content",
      "authentication_policy" : "APP_LEVEL",
      "authentication_protocol" : "TOKEN_AUTH",
      "created_by" : "admin",
      "created_on" : "2020-04-06T10:00:00.000+00:00",
      "last_modified_by" : "admin",
      "last_modified_on" : "2020-04-06T10:00:00.000+00:00",
      "_links" : {
        "self" : {
          "href" : "http://localhost:8080/api/rest/latest/ai-servers/3"
        }
      }
    }, {
      "id" : 12,
      "name" : "second ai server",
      "url" : "https://openai.com/",
      "description" : "another description so admin knows what he is doing",
      "payload_template" : "json you can get in the doc of your provider",
      "json_path" : "[42][1984]",
      "authentication_policy" : "APP_LEVEL",
      "authentication_protocol" : "TOKEN_AUTH",
      "created_by" : "admin",
      "created_on" : "2020-04-06T10:00:00.000+00:00",
      "last_modified_by" : "admin",
      "last_modified_on" : "2020-04-06T10:00:00.000+00:00",
      "_links" : {
        "self" : {
          "href" : "http://localhost:8080/api/rest/latest/ai-servers/12"
        }
      }
    }, {
      "id" : 13,
      "name" : "third ai server",
      "url" : "https://otplol.com/",
      "description" : "I think it is clear now",
      "payload_template" : "json you can get in the doc of your provider",
      "json_path" : "can.also.look.like.this",
      "authentication_policy" : "APP_LEVEL",
      "authentication_protocol" : "TOKEN_AUTH",
      "created_by" : "admin",
      "created_on" : "2020-04-06T10:00:00.000+00:00",
      "last_modified_by" : "admin",
      "last_modified_on" : "2020-04-06T10:00:00.000+00:00",
      "_links" : {
        "self" : {
          "href" : "http://localhost:8080/api/rest/latest/ai-servers/13"
        }
      }
    } ]
  },
  "_links" : {
    "self" : {
      "href" : "http://localhost:8080/api/rest/latest/ai-servers?page=0&size=20"
    }
  },
  "page" : {
    "size" : 20,
    "totalElements" : 3,
    "totalPages" : 1,
    "number" : 0
  }
}

Response fields

Path Type Description

_embedded.ai-servers

Array

the list of elements for that page

page.size

Number

the page size for that query

page.totalElements

Number

total number of elements

page.totalPages

Number

how many pages can be browsed

page.number

Number

the page number

_links

Object

related links

Relation Description

first

link to the first page (optional)

prev

link to the previous page (optional)

self

link to this page

next

link to the next page (optional)

last

link to the last page (optional)

get Get AI server

A GET to /ai-servers/{id} returns the AI server with the given id.

HTTP request

GET /api/rest/latest/ai-servers/3 HTTP/1.1
Accept: application/json
Host: localhost:8080

Path parameters

Table 1. /api/rest/latest/ai-servers/{id}
Parameter Description

id

the id of the artificial intelligence server

HTTP response

HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 1265

{
  "id" : 3,
  "name" : "an ai server",
  "url" : "https://api.openai.com/v1/chat/completions",
  "description" : "This server should be used for generating test case, link it with projects 2, 4 and 12",
  "payload_template" : "{\"model\": \"gpt-4-1106-preview\", \"messages\": [{\"role\": \"user\", \"content\": \"You are a manual tester. You must transform a requirement into one or several test cases, written in English. The description of the test case must consist of a sum up of the given requirement. Your answer must have this format : \"{\"testCases\":[{\"name\":\"\",\"description\":\"\",\"prerequisites\":\"\",\"testSteps\":[{\"index\":0,\"action\":\"\",\"expectedResult\":\"\"}]}]\"{{ requirement }}\"}] ,\"temperature\": 0.9, \"top_p\": 0.9, \"n\": 1, \"stream\": false, \"max_tokens\": 2000, \"presence_penalty\": 0, \"frequency_penalty\": 0}",
  "json_path" : "choices[0].message.content",
  "authentication_policy" : "APP_LEVEL",
  "authentication_protocol" : "TOKEN_AUTH",
  "created_by" : "admin",
  "created_on" : "2020-04-06T10:00:00.000+00:00",
  "last_modified_by" : "admin",
  "last_modified_on" : "2020-04-06T10:00:00.000+00:00",
  "_links" : {
    "self" : {
      "href" : "http://localhost:8080/api/rest/latest/ai-servers/3"
    }
  }
}

Response fields

Path Type Description

id

Number

the id of the artificial intelligence server

name

String

the name of the artificial intelligence server

url

String

the url of the remote artificial intelligence server

authentication_policy

String

the authentication policy of the artificial intelligence server (APP_LEVEL by default)

authentication_protocol

String

the authentication protocol of the artificial intelligence server (TOKEN_AUTH by default)

payload_template

String

a pre-formatted payload containing query parameters and a placeholder, designed for submission to an AI service for processing

description

String

a description of the server

json_path

String

a string expression used to navigate and extract specific nodes to access the generated answer in the response

created_by

String

user who created the entity

created_on

String

timestamp of the creation (ISO 8601)

last_modified_by

String

user who modified the entity the most recently

last_modified_on

String

timestamp of last modification (ISO 8601)

_links

Object

related links

Relation Description

self

link to this artificial intelligence server

post Create AI server

A POST to /ai-servers creates a new AI server.

HTTP request

POST /api/rest/latest/ai-servers HTTP/1.1
Content-Type: application/json
Accept: application/json
Content-Length: 874
Host: localhost:8080

{
  "name" : "New Ai Server",
  "url" : "https://openai.com/",
  "description" : "This server should be used for generating test case, link it with projects 1, 11 and 12",
  "payload_template" : "{\"model\": \"gpt-4-1106-preview\", \"messages\": [{\"role\": \"user\", \"content\": \"You are a manual tester. You must transform a requirement into one or several test cases, written in English. The description of the test case must consist of a sum up of the given requirement. Your answer must have this format : \"{\"testCases\":[{\"name\":\"\",\"description\":\"\",\"prerequisites\":\"\",\"testSteps\":[{\"index\":0,\"action\":\"\",\"expectedResult\":\"\"}]}]\"{{ requirement }}\"}] ,\"temperature\": 0.9, \"top_p\": 0.9, \"n\": 1, \"stream\": false, \"max_tokens\": 2000, \"presence_penalty\": 0, \"frequency_penalty\": 0}",
  "json_path" : "choices[0].message.content"
}

Request fields

Path Type Description

name

String

the name of the ai server

url

String

the url of the ai server

description

String

a description of the server

payload_template

String

a pre-formatted payload containing query parameters and a placeholder, designed for submission to an AI service for processing

json_path

String

a string expression used to navigate and extract specific nodes to access the generated answer in the response

HTTP response

HTTP/1.1 201 Created
Content-Type: application/json
Content-Length: 1244

{
  "id" : 6,
  "name" : "New Ai Server",
  "url" : "https://openai.com/",
  "description" : "This server should be used for generating test case, link it with projects 1, 11 and 12",
  "payload_template" : "{\"model\": \"gpt-4-1106-preview\", \"messages\": [{\"role\": \"user\", \"content\": \"You are a manual tester. You must transform a requirement into one or several test cases, written in English. The description of the test case must consist of a sum up of the given requirement. Your answer must have this format : \"{\"testCases\":[{\"name\":\"\",\"description\":\"\",\"prerequisites\":\"\",\"testSteps\":[{\"index\":0,\"action\":\"\",\"expectedResult\":\"\"}]}]\"{{ requirement }}\"}] ,\"temperature\": 0.9, \"top_p\": 0.9, \"n\": 1, \"stream\": false, \"max_tokens\": 2000, \"presence_penalty\": 0, \"frequency_penalty\": 0}",
  "json_path" : "choices[0].message.content",
  "authentication_policy" : "APP_LEVEL",
  "authentication_protocol" : "TOKEN_AUTH",
  "created_by" : "admin",
  "created_on" : "2020-04-06T10:00:00.000+00:00",
  "last_modified_by" : "admin",
  "last_modified_on" : "2020-04-06T10:00:00.000+00:00",
  "_links" : {
    "self" : {
      "href" : "http://localhost:8080/api/rest/latest/ai-servers/6"
    }
  }
}

Response fields

Path Type Description

id

Number

the id of the artificial intelligence server

name

String

the name of the artificial intelligence server

url

String

the url of the remote artificial intelligence server

authentication_policy

String

the authentication policy of the artificial intelligence server APP_LEVEL by default

authentication_protocol

String

the authentication protocol of the artificial intelligence server TOKEN_AUTH by default

payload_template

String

a pre-formatted payload containing query parameters and a placeholder, designed for submission to an AI service for processing

description

String

a description of the server

json_path

String

a string expression used to navigate and extract specific nodes to access the generated answer in the response

created_by

String

user who created the entity

created_on

String

timestamp of the creation (ISO 8601)

last_modified_by

String

user who modified the entity the most recently

last_modified_on

String

timestamp of last modification (ISO 8601)

_links

Object

related links

Relation Description

self

link to this ai server

patch Modify an AI server

A PATCH to /ai-servers/{id} modifies the AI server with the given id.

HTTP request

PATCH /api/rest/latest/ai-servers/4 HTTP/1.1
Content-Type: application/json
Accept: application/json
Content-Length: 874
Host: localhost:8080

{
  "name" : "New Ai Server",
  "url" : "https://openai.com/",
  "description" : "This server should be used for generating test case, link it with projects 1, 11 and 12",
  "payload_template" : "{\"model\": \"gpt-4-1106-preview\", \"messages\": [{\"role\": \"user\", \"content\": \"You are a manual tester. You must transform a requirement into one or several test cases, written in English. The description of the test case must consist of a sum up of the given requirement. Your answer must have this format : \"{\"testCases\":[{\"name\":\"\",\"description\":\"\",\"prerequisites\":\"\",\"testSteps\":[{\"index\":0,\"action\":\"\",\"expectedResult\":\"\"}]}]\"{{ requirement }}\"}] ,\"temperature\": 0.9, \"top_p\": 0.9, \"n\": 1, \"stream\": false, \"max_tokens\": 2000, \"presence_penalty\": 0, \"frequency_penalty\": 0}",
  "json_path" : "choices[0].message.content"
}

Path parameters

Table 1. /api/rest/latest/ai-servers/{id}
Parameter Description

id

the id of the ai server

Request fields

Path Type Description

name

String

the name of the ai server

url

String

the url of the ai server

description

String

a description of the server

payload_template

String

a pre-formatted payload containing query parameters and a placeholder, designed for submission to an AI service for processing

json_path

String

a string expression used to navigate and extract specific nodes to access the generated answer in the response

HTTP response

HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 1256

{
  "id" : 4,
  "name" : "New Name for Ai Server",
  "url" : "https://NewAdress.net/",
  "description" : "This server should be used for generating test case, link it with projects 1, 11 and 12",
  "payload_template" : "{\"model\": \"gpt-4-1106-preview\", \"messages\": [{\"role\": \"user\", \"content\": \"You are a manual tester. You must transform a requirement into one or several test cases, written in English. The description of the test case must consist of a sum up of the given requirement. Your answer must have this format : \"{\"testCases\":[{\"name\":\"\",\"description\":\"\",\"prerequisites\":\"\",\"testSteps\":[{\"index\":0,\"action\":\"\",\"expectedResult\":\"\"}]}]\"{{ requirement }}\"}] ,\"temperature\": 0.9, \"top_p\": 0.9, \"n\": 1, \"stream\": false, \"max_tokens\": 2000, \"presence_penalty\": 0, \"frequency_penalty\": 0}",
  "json_path" : "choices[0].message.content",
  "authentication_policy" : "APP_LEVEL",
  "authentication_protocol" : "TOKEN_AUTH",
  "created_by" : "admin",
  "created_on" : "2020-04-06T10:00:00.000+00:00",
  "last_modified_by" : "admin",
  "last_modified_on" : "2020-04-06T10:00:00.000+00:00",
  "_links" : {
    "self" : {
      "href" : "http://localhost:8080/api/rest/latest/ai-servers/4"
    }
  }
}

Response fields

Path Type Description

id

Number

the id of the artificial intelligence server

name

String

the name of the artificial intelligence server

url

String

the url of the remote artificial intelligence server

authentication_policy

String

the authentication policy of the artificial intelligence server (APP_LEVEL by default)

authentication_protocol

String

the authentication protocol of the artificial intelligence server (TOKEN_AUTH by default)

payload_template

String

a pre-formatted payload containing query parameters and a placeholder, designed for submission to an AI service for processing

description

String

a description of the server

json_path

String

a string expression used to navigate and extract specific nodes to access the generated answer in the response

created_by

String

user who created the entity

created_on

String

timestamp of the creation (ISO 8601)

last_modified_by

String

user who modified the entity the most recently

last_modified_on

String

timestamp of last modification (ISO 8601)

_links

Object

related links

Relation Description

self

link to this ai server

delete Delete AI server

A DELETE to /ai-servers/{ids} deletes one or several AI server(s) with the given id(s).

HTTP request

DELETE /api/rest/latest/ai-servers/3 HTTP/1.1
Content-Type: application/json
Accept: application/json
Host: localhost:8080

Path parameters

Table 1. /api/rest/latest/ai-servers/{ids}
Parameter Description

ids

a list of ids of the ai servers to delete

HTTP response

HTTP/1.1 204 No Content

get Get AI server credentials

A GET to /ai-servers/{id}/credentials get the credentials of the AI server with the given id.

HTTP request

GET /api/rest/latest/ai-servers/1/credentials HTTP/1.1
Content-Type: application/json
Accept: application/json
Host: localhost:8080

Path parameters

Table 1. /api/rest/latest/ai-servers/{id}/credentials
Parameter Description

id

the id of the ai server

HTTP response

HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 161

{
  "_type" : "token-auth-credentials",
  "_links" : {
    "self" : {
      "href" : "http://localhost:8080/api/rest/latest/ai-servers/1/credentials"
    }
  }
}

Response fields

Path Type Description

_type

String

type of credentials, it can only be token-auth-credentials

_links

Object

related links

post Set AI server credentials

A POST to /ai-server/{id}/credentials set the credentials of the AI server with the given id.

HTTP request

POST /api/rest/latest/ai-servers/1/credentials HTTP/1.1
Content-Type: application/json
Accept: application/json
Content-Length: 76
Host: localhost:8080

{
  "_type" : "token-auth-credentials",
  "token" : "qEdK6ZEDfEV14BAPiFHE"
}

Path parameters

Table 1. /api/rest/latest/ai-servers/{id}/credentials
Parameter Description

id

the id of the ai server

Request fields

Path Type Description

_type

String

the type of the credentials: token-auth-credentials

token

String

the token to authenticate to this ai server

HTTP response

HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 161

{
  "_type" : "token-auth-credentials",
  "_links" : {
    "self" : {
      "href" : "http://localhost:8080/api/rest/latest/ai-servers/1/credentials"
    }
  }
}

Response fields

Path Type Description

_type

String

the type of the credentials: token-auth-credentials

_links

Object

related links