Skip to content

Commit

Permalink
Also mention the --verbose option of openqa-cli
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Apr 30, 2020
1 parent 1288747 commit 0df6100
Showing 1 changed file with 32 additions and 9 deletions.
41 changes: 32 additions & 9 deletions docs/Client.asciidoc
Expand Up @@ -3,7 +3,7 @@
= openQA client
:toc: left
:toclevels: 6
:author: Sebastian Riedel
:author: openQA Team

There are two ways to interact with openQA as a user. The web UI and the REST
API. In this guide we will focus on the latter. You've probably already seen a
Expand All @@ -28,7 +28,7 @@ curl http://openqa.example.com/api/v1/jobs/overview?result=failed
----

But not all REST endpoints are public. Some also require authentication with an
API key and secret. And that's usually where you reach the limits of `curl`,
API key and secret. And that is usually where you reach the limits of `curl`,
because this key and secret are used to generate an individual checksum for
every request.

Expand Down Expand Up @@ -218,7 +218,7 @@ option (or `-p` for short), `openqa-cli` can reformat it for you.
openqa-cli api --host http://openqa.example.com --pretty jobs/overview
----

The JSON will re-encoded with newlines and indentation for much better
The JSON will be re-encoded with newlines and indentation for much better
readability.

[source,json]
Expand Down Expand Up @@ -281,14 +281,36 @@ openqa-cli api --o3 jobs/overview

=== Debugging

Sometimes it can be hard to guess what the final HTTP request generated by
`openqa-cli api` will look like. For these cases you can experiment with the
`MOJO_CLIENT_DEBUG` environment variable.
Often times just seeing the HTTP response body might not be enough to debug a
problem. With the `--verbose` option (or `-v` for short) you can also get
additional information printed.

[source,sh]
----
openqa-cli api --host http://openqa.example.com --verbose -X POST \
jobs/407/comments text="Hello openQA!"
----

This includes the HTTP response status line, as well as headers.

----
HTTP/1.1 403 Forbidden
Content-Type: application/json;charset=UTF-8
Strict-Transport-Security: max-age=31536000; includeSubDomains
Server: Mojolicious (Perl)
Content-Length: 41
Date: Wed, 29 Apr 2020 12:03:11 GMT
{"error":"no api key","error_status":403}
----

And if that is not enough, you can experiment with the `MOJO_CLIENT_DEBUG`
environment variable.

[source,sh]
----
MOJO_CLIENT_DEBUG=1 openqa-cli api --host http://openqa.example.com -X POST \
jobs/407/comments text="Hello openQA"
jobs/407/comments text="Hello openQA!"
----

It will activate a debug feature in the Mojolicious framework, which openQA uses
Expand All @@ -310,12 +332,13 @@ text=Hello+openQA%21
----

Just be aware that this is a feature the openQA team does not control, and the
output will change a bit over time.
exact output as well as how it escapes control characters will change a bit over
time.

== Archive mode

With the `archive` subcommand of `openqa-cli` you can download all the assets
and test results of a job for archiving or debugging puproses.
and test results of a job for archiving or debugging purposes.

----
openqa-cli archive --host http://openqa.example.com 408 /tmp/openqa_job_408
Expand Down

0 comments on commit 0df6100

Please sign in to comment.