How to search for a server by name and start a test

You’ve registered a server at Operous, and you need to fetch its information and start a test execution. This guide covers these topics.

Locating your server

Use the server query to retrieve the data of a specific server, use the server name to get the correct server.

Query:

{
  server(input:{value: "ubiquitous-chicken-8974", kind:NAME}){
    identifier
    name
  }
}

The query on curl request:

curl -X POST \
-H 'Authorization: Token <Account access token>' \
-H 'Content-Type: application/json' \
-d '{"query":"{  server(input:{value: \"ubiquitous-chicken-8974\", kind:NAME}){    identifier    name  }}"}' \
'https://app.operous.dev/graphql'

Response:

{
  "data":  {
    "server": {
      "identifier": "7QiCIABxXyXe",
      "name": "webapp-01"
    }
  }
}

Starting the test

With the response in hands, take the identifier field and use the startTestRun mutation to start the test on the server.

Mutation:

mutation {
  startTestRun (input: {serverId: "7QiCIABxXyXe"})
}

The same mutation on a curl request:

curl -X POST \
-H 'Authorization: Token <Account access token>' \
-H 'Content-Type: application/json' \
-d '{"query":"mutation {  startTestRun (input: {serverId: \"gMAjMO8mkmhsFRxW\"})}"}' \
'https://app.operous.dev/graphql'

Response:

{
  "data":  {
    "startTestRun": 1
  }
}

The mutation returns the number of the test run. Follow this guide to get the test status and information. Alternatively, you can accompany the test through the Operous webpage.