|
NAMEopenxpkicli - command line tool for running API requests USAGEopenxpkicli [options] command Options (all arguments are optional):
--help brief help message
--help COMMAND show help for given API command
--man full documentation
--list list all available API commands
--socketfile FILE OpenXPKI daemon socket file
--instance NAME Shortcut to set socket on multi-instance configs
--realm REALM OpenXPKI realm
--authstack STACK authentication stack to use
--authuser USER authentication user
--authpass PASS password for authentication user
--arg KEY=VALUE pass VALUE to method as parameter KEY
--filearg KEY=FILE as --arg but read value from file name
--param VALUE stack VALUE onto methods PARAMS array
--param KEY=VALUE set VALUE in methods PARAMS hash using KEY
--debug enable debug mode
--timeout socket timeout in seconds (default 30s)
--json activate json mode
If active you can pass either a JSON string or
a filename to read a json string from as second
argument AFTER the command name. The parameters
are merged with the other arguments.
--json-pretty human readble json
--session session mode, see below for details
Output control - use for testing and debugging only and might change anytime!
--out FILE Write output to FILE instead of STDOUT. Works only in
conjunction with --json or if the result is a single
scalar value.
--fileout KEY=FILE Write the value of the result item KEY to FILE.
No file is written if the KEY is not part of the
result, dies if the file exists.
INVOCATIONInvoke the named command through the OpenXPKI API using the given connection socket. Anything passed using "arg" is added to the methods argument list, you can also add arguments after the special argument "--" at the end of the line. If the method has a PARAMS argument which accepts an array or hash, you can use param to fill this argument. You must not mix value only and key=value param calls on one command. EXAMPLESopenxpkicli --realm "Server CA" --arg message=testmail \
openxpkicli --realm "Server CA" get_token_info -- alias=vault-2 Operational ModesBatchThis is the default mode, you must pass all parameters as arguments as stated above. The client will try to login with the credentials given (or as anonymous) and run the provided command. SessionActivated by adding --session to the command line. This mode allows you to reuse an existing session id for subsequent calls to a command. The session id must be passed in the environment variable OPENXPKI_SESSION_ID. To initialize a session, call openxpkicli with the expected auth* parameters and pass login as command. This will perform the login and print the session id as output. Put the received id into the environment and run your commands. If you are done, pass command logout. If you are using bash, the output of the init command can be directly passed to an eval to set the environment. Note: session mode is currently not fully compatible with --json (session init and error handling do not print proper json). Example openxpkicli --authstack=Testing --authuser=raop --authpass=openxpki \
--session login
echo $OPENXPKI_SESSION_ID
openxpkicli --session get_session_info
openxpkicli --session logout
Pass --session as parameter and pass the ID of an existings session in JSON Mode openxpkicli --json search_workflow_instances_count '{"proc_state":["exception","retry_exceeded"]}'
InteractiveNot supported yet :)
|