for use with Nuxeo Platform 5.8
`` nuxeo-rest-api `` just a small part of this API is implimented in pynux.
These commands list documents in nuxeo.
By default uid and path with be printed on standard out.
Specifing an --outdir parameter with a directory name will cause a JSON dump of the list to be output, with one .json file per document. TODO: what if a document path contains .json? Should outdir use uids for file names?
usage: nxls [-h] [--outdir OUTDIR] [--loglevel LOGLEVEL] [--rcfile RCFILE]
path
nuxeo metadata via REST API
positional arguments:
path nuxeo document path
optional arguments:
-h, --help show this help message and exit
--outdir OUTDIR directory to hold application/json+nxentity .json files
common options for pynux commands:
--loglevel LOGLEVEL CRITICAL ERROR WARNING INFO DEBUG NOTSET, default is
ERROR
--rcfile RCFILE path to ConfigParser compatible ini file
usage: nxql [-h] [--outdir OUTDIR] [--loglevel LOGLEVEL] [--rcfile RCFILE]
nxql
nxql via REST API
positional arguments:
nxql nxql query
optional arguments:
-h, --help show this help message and exit
--outdir OUTDIR directory to hold application/json+nxentity .json files
common options for pynux commands:
--loglevel LOGLEVEL CRITICAL ERROR WARNING INFO DEBUG NOTSET, default is
ERROR
--rcfile RCFILE path to ConfigParser compatible ini file
SELECT * FROM Documents
Does not support --outdir
usage: nxql_all [-h] [--loglevel LOGLEVEL] [--rcfile RCFILE]
nuxeo metadata via REST API
optional arguments:
-h, --help show this help message and exit
common options for pynux commands:
--loglevel LOGLEVEL CRITICAL ERROR WARNING INFO DEBUG NOTSET, default is
ERROR
--rcfile RCFILE path to ConfigParser compatible ini file
update one nuxeo document from a .json input file.
if no uid nor path was specified on the command line, then look in the JSON file and prefer "path": to "uid": when because the JSON file may have come from another machine where the uuids are different. If no documentid is found it exits with an error.
Nuxeo JSON output is returned on standard out. Nuxeo returns the JSON of the updated document. (TODO I guess nxup1 could check the returned JSON and make sure it looks like the update was a-okay.)
usage: nxup1 [-h] [--uid UID | --path PATH] [--loglevel LOGLEVEL]
[--rcfile RCFILE]
file
nuxeo metadata via REST API, one record
positional arguments:
file application/json+nxentity
optional arguments:
-h, --help show this help message and exit
--uid UID update specific nuxeo uid
--path PATH update specific nuxeo path
common options for pynux commands:
--loglevel LOGLEVEL CRITICAL ERROR WARNING INFO DEBUG NOTSET, default is
ERROR
--rcfile RCFILE path to ConfigParser compatible ini file
init and set up logging.
usage: pilog [-h] [--activate] [--loglevel LOGLEVEL] [--rcfile RCFILE]
nuxeo platform importer log/logActivate
optional arguments:
-h, --help show this help message and exit
--activate
common options for pynux commands:
--loglevel LOGLEVEL CRITICAL ERROR WARNING INFO DEBUG NOTSET, default is
ERROR
--rcfile RCFILE path to ConfigParser compatible ini file
check if an import is running. Don’t run more than one job at once! Will return HTTP result from nuxeo on standard out which will either be Running or Not Running.
usage: pistatus [-h] [--loglevel LOGLEVEL] [--rcfile RCFILE]
nuxeo platform importer status
optional arguments:
-h, --help show this help message and exit
common options for pynux commands:
--loglevel LOGLEVEL CRITICAL ERROR WARNING INFO DEBUG NOTSET, default is
ERROR
--rcfile RCFILE path to ConfigParser compatible ini file
Trigger /run of bulk importer. By default, it won’t exit until the async loading is finished, so that it can be used from a batch script.
usage: pifolder [-h] [--loglevel LOGLEVEL] [--rcfile RCFILE] --leaf_type
LEAF_TYPE --input_path INPUT_PATH --target_path TARGET_PATH
--folderish_type FOLDERISH_TYPE [--no_wait]
[--poll_interval SLEEP]
run import of a folder into nuxeo
optional arguments:
-h, --help show this help message and exit
--no_wait don't poll/wait for the job to finish
--poll_interval SLEEP
seconds to sleep for if waiting
common options for pynux commands:
--loglevel LOGLEVEL CRITICAL ERROR WARNING INFO DEBUG NOTSET, default is
ERROR
--rcfile RCFILE path to ConfigParser compatible ini file
there are four required arguments:
--leaf_type LEAF_TYPE
nuxeo document type for imported leaf nodes
--input_path INPUT_PATH
unix path to files
--target_path TARGET_PATH
target document for import in nuxeo (parent folder
where new folder will be created)
--folderish_type FOLDERISH_TYPE
nuxeo document type for imported folder
short example
from pynux import utils
nx = utils.Nuxeo()
nx.nxql('SELECT * from Documents');
nx.all()
nx.children("asset-library")
uid = nx.get_uid("asset-library")
nx.get_metadata(uid=uid)
nx.get_metadata(path="asset-library")
python function library for working with nuxeo “REST” APIs.
utility functions for nuxeo
Object’s data keeps track of URLs and credentials for Nuxeo REST API and Nuxeo Platoform Importer / bulk import API
Parameters: |
|
---|
generator iterator for nuxeo results
Parameters: |
|
---|---|
Returns: | iterator of nuxeo API results |
get a single page of nuxeo API results
Parameters: |
|
---|---|
Returns: | json from nuxeo |
works the way a good mkdir should :) - already exists, silently complete - regular file in the way, raise an exception - parent directory(ies) does not exist, make them as well
.nxql(“SELECT * FROM Document”)
Returns: | iterator of nuxeo API results |
---|
generic wrapper to make GET calls to this API
get child documents of a path
Returns: | iterator of nuxeo API results |
---|
get metadata for a document
Parameters: | documentid – either uid= or path= |
---|---|
Returns: | json from nuxeo |
look up uid from the path
Parameters: | path (string) – nuxeo path for a document |
---|---|
Returns: | uid |
Return type: | string |
show small part of file importer log
activate file importer log
trigger an import and wait for it to finish
Parameters: |
|
---|---|
Returns: | STDOUT |
check import status and wait for Not Running
generic nxql query
Returns: | iterator of nuxeo API results |
---|
update nuxeo document properties
Parameters: |
|
---|---|
Returns: | updated json from nuxeo |
common options for command line programs that use the library
Parameters: | argvarse_parser – an argparse parser |
---|---|
Returns: | argparse parser parameter group |