How can I access Retraced API in an on-prem install?


#1

Obtaining an API token

  1. Navigate to the Audit Log page and click the Manage Tokens icon
  2. Click Create new token button
  3. Name the token and click the Create Token button
  4. The new token should be display. If this instance already has at least one token, this is the screen that will be shown after clicking the Manage Tokens icon.

Formatting the request

The following headers are required in the request:

  • Authorization
  • Content-Type

More information can be found in the API documentation.

curl -k 'https://10.111.110.179:9880/retraced-api/enterprise/v1/graphql' \
  -H 'Authorization: token=b376707b9af44b93b4ebbf8f2915df59' \
  -H 'Content-Type: application/json' \
  --data-binary $'{"variables":{"query":"crud:c,u,d","last":20,"before":""},"query":"\\n        query Search($query: String\u0021, $last: Int, $before: String) {\\n          search(query: $query, last: $last, before: $before) {\\n            totalCount\\n            pageInfo {\\n              hasPreviousPage\\n            }\\n            edges {\\n              cursor\\n              node {\\n                id\\n                action\\n                crud\\n                created\\n                received\\n                canonical_time\\n                description\\n                actor {\\n                  id\\n                  name\\n                  href\\n                }\\n                group {\\n                  id\\n                  name\\n                }\\n                target {\\n                  id\\n                  name\\n                  href\\n                  type\\n                }\\n                display {\\n                  markdown\\n                }\\n                is_failure\\n                is_anonymous\\n                source_ip\\n                country\\n                loc_subdiv1\\n                loc_subdiv2\\n                raw\\n              }\\n            }\\n          }\\n        }"}' 

Obtaining API address and port

Accessing the API depends on the scheduler used for the instance.

AKA (Kubernetes)

The API will be accessible from cluster nodes via the replicated-premkit service or from within the cluster as retraced-api.default.svc.cluster.local

$ kubectl get svc | grep premkit
replicated-premkit    ClusterIP   10.111.110.179   <none>        9880/TCP                              18h

Native

TODO

Swarm

TODO