Forming activity service API requests
Token-based authentication is required to access the activity service API. You can authenticate requests with user authentication tokens or allowed certificates.
URI
path following the
pattern:https://<DNS>:4433/activity-api/<VERSION>/<ENDPOINT>
-
DNS
: Your PE console host's DNS name. You can uselocalhost
, manually enter the DNS name, or use apuppet
command (as explained in Using example commands). -
VERSION
: Eitherv1
orv2
, depending on the endpoint. -
ENDPOINT
: Eitherevents
orevents.csv
, depending on the endpoint.
https://$(puppet config print server):4433/activity-api/v1/events
https://localhost:4433/activity-api/v1/events
https://puppet.example.dns:4433/activity-api/v1/events
To form a complete curl command, you need to provide appropriate curl arguments, authentication, and you might need to supply additional parameters specific to the endpoint you are calling.
For general information about forming curl commands, authentication in commands, and Windows modifications, go to Using example commands.
Token authentication
You can use token or certificate authentication with the activity service API.
For instructions on generating, configuring, revoking, and deleting authentication tokens in PE, go to Token-based authentication.
puppet-access show
,
such
as:auth_header="X-Authentication: $(puppet-access show)"
uri="https://$(puppet config print server):4433/activity-api/v1/events"
curl --header "$auth_header" "$uri"
auth_header="X-Authentication: <TOKEN>"
uri="https://$(puppet config print server):4433/activity-api/v1/events"
curl --header "$auth_header" "$uri"
For general information about forming curl commands, authentication in commands, and Windows modifications, go to Using example commands.
Allowed certificate authentication
allowlist
, which is located
at:/etc/puppetlabs/console-services/rbac-certificate-allowlist
rbac-certificate-allowlist
file, you must reload the
pe-console-services
service for your changes to take
effect. To reload the service run: sudo service pe-console-services
reload
rbac-certificate-allowlist
file) and, if necessary,
the private key. For
example:cert="$(puppet config print hostcert)"
cacert="$(puppet config print localcacert)"
key="$(puppet config print hostprivkey)"
uri="https://$(puppet config print server):4433/activity-api/v1/events"
curl --cert "$cert" --cacert "$cacert" --key "$key" "$uri"
puppet cert generate
command to create a certificate to use
specifically with the activity service API.