Skip to content

pman verb: GET

Rudolph Pienaar edited this page Mar 21, 2017 · 8 revisions

pman verb: GET

Abstract

This page describes the behavior of the REST verb GET in the context of pman. It is used to simply get information from the pman database / datatree and is directly analogous to the get command in the POST verb form. In the GET verb form, however, the path to retrieve is directly specified in the http URL.

Preconditions

  • This page assumes that pman is listening on: 172.17.0.2:5010.
  • Make sure that pman has been started (see here for more info):
pman --rawmode 1 --http --port 5010 --listeners 12
  • This page assumes that a previous run has been managed with parameters
{  "action": "run",
        "meta": {
                "cmd":      "cal 7 1970",
                "auid":     "rudolphpienaar",
                "jid":      "cal-job-1234",
                "threaded": true
        }
}

msg summary

There is no msg payload for a GET verb.

GET

Start prefix

Start the purl command with

purl --verb GET --raw --http 172.17.0.2:5010/api/v1/

simple copy/paste the above line into a terminal. Do not press enter!

Assuming satisfied preconditions, let's simply get some elements directly from the pman database/datatree. The representation of data in the pman database is directly equivalent also to how data is saved to the pman database on the host machine running the pman service.

Simply hitting enter on the above command will return the "homepage" and list of all jobs currently in the database. For legibility you can append the following:

--quiet --jsonpprintindent 4

return payload

The above returns a JSON string

{
    "payloadsize": 53,
    "meta": {
        "path": "/"
    },
    "receivedByServer": [
        "POST /api/v1/cmd HTTP/1.1\r",
        "Host: 172.17.0.2:5010\r",
        "User-Agent: PycURL/7.43.0 libcurl/7.47.0 GnuTLS/3.4.10 zlib/1.2.8 libidn/1.32 librtmp/2.3\r",
        "Accept: */*\r",
        "Content-type: application/vnd.collection+json\r",
        "Content-Length: 53\r",
        "\r",
        "{\"payload\": {\"action\": \"get\", \"meta\": {\"path\": \"/\"}}}"
    ],
    "RESTheader": "POST /api/v1/cmd HTTP/1.1\r",
    "RESTverb": "POST",
    "action": "get",
    "path": "/api/v1/cmd",
    "status": true,
    "d_ret": {
        "20170309101124.645898_fc21bad8-6044-4a4f-9e60-3176912e141f": {},
        "20170308164211.942222_5f540393-9ed4-489e-8a65-1ae636d16424": {},
        "20170309104249.802089_60befd86-e8b3-44ae-b80f-2b45cab14313": {},
        "20170309103920.158002_81c65d31-383a-4c79-be80-0ffff2bfd5ad": {},
        "20170303164938.122651_6e09943c-6fc0-45c8-b088-2394e5886b69": {},
        "20170309104746.783742_5b9fcb3d-2e1b-4caa-bc87-84bfb5c2cd70": {},
        "20170303210038.021641_828b47d8-d64d-4078-8a19-5f202c069d78": {},
        "20170303210026.421217_72c99079-d099-441b-b005-98076e37002b": {}
    }
}

which defines the set of jobs that have been managed and exist in the pman database. By creating correct paths in the URL directive, the entire dataspace can be explored. For example, the set of data corresponding to one of the jobs is collected by appending:

20170309101124.645898_fc21bad8-6044-4a4f-9e60-3176912e141f --quiet --jsonpprintindent 4

to the initial purl directive.

Retrieve a specific quantum of information in the treespace of that job:

20170309101124.645898_fc21bad8-6044-4a4f-9e60-3176912e141f/end/0/endInfo/0/platform --quite --jsonpprintindent 4

--30--