@commercelayer/cli-plugin-resources
Commerce Layer CLI Resources plugin
Usage
To install as a Commerce Layer CLI plugin run the following command:
$ commercelayer plugins:install resources
Commands
commercelayer resources
List all the available Commerce Layer API resources.
USAGE
$ commercelayer resources [-h]
FLAGS
-h, --help Show CLI help.
DESCRIPTION
list all the available Commerce Layer API resources
EXAMPLES
$ cl-resources resources
$ cl-res resources
$ commercelayer resources
$ cl resources
See code: src/commands/resources/index.ts
commercelayer resources:all RESOURCE
Fetch all resources.
USAGE
$ commercelayer resources:all [RESOURCE] -o <value> [-i <value>] [-u -j] [-l curl|node -D] [--curl ] [--node ]
[--save-args <value>] [--load-args <value>] [-w <value>] [-s <value>] [-x <value> | -X <value>] [-H <value> [-C -f
<value>]] [-b] [-e <value> | -R]
ARGUMENTS
RESOURCE the resource type
FLAGS
-C, --csv export fields in csv format
-D, --doc shows the CLI command in a specific language
-H, --header=<value>... rename column headers defining a comma-separated list of values field:"renamed title"
-R, --raw print out the raw API response
-X, --save-path=<value> save command output to file and create missing path directories
-b, --blind execute in blind mode without prompt and progress bar
-e, --extract=<value>... extract subfields from object attributes
-f, --fields=<value>... comma separeted list of fields in the format [resource]=field1,field2...
-i, --include=<value>... comma separated resources to include
-j, --json convert output in standard JSON format
-l, --lang=<option> show the CLI command in the specified language syntax
<options: curl|node>
-o, --organization=<value> (required) the slug of your organization
-s, --sort=<value>... defines results ordering
-u, --unformatted print unformatted JSON output
-w, --where=<value>... comma separated list of query filters
-x, --save=<value> save command output to file
--curl show the equivalent cURL command of the CLI command
--load-args=<value> load previously saved command arguments
--node show the equivalent Node SDK source code of the CLI command
--save-args=<value> save command data to file for future use
DESCRIPTION
fetch all resources
ALIASES
$ commercelayer all
$ commercelayer ra
$ commercelayer res:all
EXAMPLES
$ commercelayer resources:all customers -f id,email -i customer_group -s updated_at
$ cl res:all -i customer_group -f customer_groups/name -w customer_group_name_eq="GROUP NAME"
$ cl all -s -created_at --json
See code: src/commands/resources/all.ts
commercelayer resources:args
Show all the saved command arguments.
USAGE
$ commercelayer resources:args [-D [-a <value> -o list|retrieve|create|update -r <value>]]
FLAGS
-D, --delete delete saved arguments associated to the alias
-a, --alias=<value> the alias associated to saved command arguments
-o, --operation=<option> the resource operation
<options: list|retrieve|create|update>
-r, --resource=<value> the resource type
DESCRIPTION
show all the saved command arguments
ALIASES
$ commercelayer res:args
See code: src/commands/resources/args.ts
commercelayer resources:create RESOURCE
Create a new resource.
USAGE
$ commercelayer resources:create [RESOURCE] -o <value> [-i <value>] [-f <value>] [-u -j] [-R] [-l curl|node -D]
[--curl ] [--node ] [-O <value>] [-D <value> | -a <value> | -r <value> | -m <value> | | --load-args <value> |
--save-args <value>]
ARGUMENTS
RESOURCE the resource type
FLAGS
-D, --data=<value> the data file to use as request body
-D, --doc shows the CLI command in a specific language
-O, --object=<value>... define a resource object attribute
-R, --raw print out the raw API response
-a, --attribute=<value>... define a resource attribute
-f, --fields=<value>... comma separeted list of fields in the format [resource]=field1,field2...
-i, --include=<value>... comma separated resources to include
-j, --json convert output in standard JSON format
-l, --lang=<option> show the CLI command in the specified language syntax
<options: curl|node>
-m, --metadata=<value>... define a metadata attribute or a set of metadata attributes
-o, --organization=<value> (required) the slug of your organization
-r, --relationship=<value>... define a relationship with another resource
-u, --unformatted print unformatted JSON output
--curl show the equivalent cURL command of the CLI command
--load-args=<value> load previously saved command arguments
--node show the equivalent Node SDK source code of the CLI command
--save-args=<value> save command data to file for future use
DESCRIPTION
create a new resource
ALIASES
$ commercelayer create
$ commercelayer rc
$ commercelayer res:create
$ commercelayer post
EXAMPLES
$ commercelayer resources:create customers -a email=user@test.com
$ clayer res:create customers -a email="user@test-com" -r customer_group=customer_groups/<customerGroupId>
$ cl create customers -a email=user@test.com -m meta_key="meta value"
$ cl rc customers -D /path/to/data/file/data.json
See code: src/commands/resources/create.ts
commercelayer resources:delete RESOURCE [ID]
Delete an existing resource.
USAGE
$ commercelayer resources:delete [RESOURCE] [ID] -o <value> [-i <value>] [-f <value>] [-u -j] [-R] [-l curl|node -D]
[--curl ] [--node ] [--save-args <value>] [--load-args <value>]
ARGUMENTS
RESOURCE the resource type
ID id of the resource to retrieve
FLAGS
-D, --doc shows the CLI command in a specific language
-R, --raw print out the raw API response
-f, --fields=<value>... comma separeted list of fields in the format [resource]=field1,field2...
-i, --include=<value>... comma separated resources to include
-j, --json convert output in standard JSON format
-l, --lang=<option> show the CLI command in the specified language syntax
<options: curl|node>
-o, --organization=<value> (required) the slug of your organization
-u, --unformatted print unformatted JSON output
--curl show the equivalent cURL command of the CLI command
--load-args=<value> load previously saved command arguments
--node show the equivalent Node SDK source code of the CLI command
--save-args=<value> save command data to file for future use
DESCRIPTION
delete an existing resource
ALIASES
$ commercelayer delete
$ commercelayer rd
$ commercelayer res:delete
EXAMPLES
$ commercelayer resources:delete customers/<customerId>
$ cl delete customers <customerId>
See code: src/commands/resources/delete.ts
commercelayer resources:doc RESOURCE
Open the default browser and show the online documentation for the resource.
USAGE
$ commercelayer resources:doc [RESOURCE]
ARGUMENTS
RESOURCE the resource for which you want to access the online documentation
DESCRIPTION
open the default browser and show the online documentation for the resource
ALIASES
$ commercelayer res:doc
EXAMPLES
$ commercelayer rdoc customers
$ cl res:doc cusatomers
See code: src/commands/resources/doc.ts
commercelayer resources:fetch PATH [ID]
Retrieve a resource or list a set of resources.
USAGE
$ commercelayer resources:fetch [PATH] [ID] -o <value> [-i <value>] [-f <value>] [-u -j] [-l curl|node -D] [--curl
] [--node ] [--save-args <value>] [--load-args <value>] [-x <value> | -X <value>] [-e <value> | -R] [-w <value>] [-p
<value>] [-n <value>] [-s <value>]
ARGUMENTS
PATH path (or URL) of the resource(s) to fetch
ID resource id
FLAGS
-D, --doc shows the CLI command in a specific language
-R, --raw print out the raw API response
-X, --save-path=<value> save command output to file and create missing path directories
-e, --extract=<value>... extract subfields from object attributes
-f, --fields=<value>... comma separeted list of fields in the format [resource]=field1,field2...
-i, --include=<value>... comma separated resources to include
-j, --json convert output in standard JSON format
-l, --lang=<option> show the CLI command in the specified language syntax
<options: curl|node>
-n, --pageSize=<value> number of elements per page
-o, --organization=<value> (required) the slug of your organization
-p, --page=<value> page number
-s, --sort=<value>... defines results ordering
-u, --unformatted print unformatted JSON output
-w, --where=<value>... comma separated list of query filters
-x, --save=<value> save command output to file
--curl show the equivalent cURL command of the CLI command
--load-args=<value> load previously saved command arguments
--node show the equivalent Node SDK source code of the CLI command
--save-args=<value> save command data to file for future use
DESCRIPTION
retrieve a resource or list a set of resources
ALIASES
$ commercelayer fetch
$ commercelayer res:fetch
$ commercelayer rf
EXAMPLES
$ commercelayer resources:fetch customers
$ commercelayer res:fetch customers
$ clayer res:fetch customers/<customerId>
$ cl fetch customers/<customerId>/<customerRelationship>
$ cl fetch customers/{customerId}/orders aBcdEkYWx
See code: src/commands/resources/fetch.ts
commercelayer resources:filters
Show a list of all available filter predicates.
USAGE
$ commercelayer resources:filters
DESCRIPTION
show a list of all available filter predicates
ALIASES
$ commercelayer res:filters
EXAMPLES
$ commercelayer resources:filters
$ cl res:filters
See code: src/commands/resources/filters.ts
commercelayer resources:get RESOURCE [ID]
Retrieve a resource or list a set of resources.
USAGE
$ commercelayer resources:get [RESOURCE] [ID] -o <value> [-i <value>] [-f <value>] [-u -j] [-l curl|node -D]
[--curl ] [--node ] [--save-args <value>] [--load-args <value>] [-w <value>] [-p <value>] [-n <value>] [-s <value>]
[-x <value> | -X <value>] [-e <value> | -R]
ARGUMENTS
RESOURCE the resource type
ID id of the resource to retrieve
FLAGS
-D, --doc shows the CLI command in a specific language
-R, --raw print out the raw API response
-X, --save-path=<value> save command output to file and create missing path directories
-e, --extract=<value>... extract subfields from object attributes
-f, --fields=<value>... comma separeted list of fields in the format [resource]=field1,field2...
-i, --include=<value>... comma separated resources to include
-j, --json convert output in standard JSON format
-l, --lang=<option> show the CLI command in the specified language syntax
<options: curl|node>
-n, --pageSize=<value> number of elements per page
-o, --organization=<value> (required) the slug of your organization
-p, --page=<value> page number
-s, --sort=<value>... defines results ordering
-u, --unformatted print unformatted JSON output
-w, --where=<value>... comma separated list of query filters
-x, --save=<value> save command output to file
--curl show the equivalent cURL command of the CLI command
--load-args=<value> load previously saved command arguments
--node show the equivalent Node SDK source code of the CLI command
--save-args=<value> save command data to file for future use
DESCRIPTION
retrieve a resource or list a set of resources
ALIASES
$ commercelayer get
$ commercelayer res:get
$ commercelayer rg
EXAMPLES
$ commercelayer resources:get customers
$ commercelayer res:get customers
$ clayer res:get customers/<customerId>
$ cl get customers <customerId>
See code: src/commands/resources/get.ts
commercelayer resources:list RESOURCE
Fetch a collection of resources.
USAGE
$ commercelayer resources:list [RESOURCE] -o <value> [-i <value>] [-f <value>] [-u -j] [-l curl|node -D] [--curl ]
[--node ] [--save-args <value>] [--load-args <value>] [-w <value>] [-p <value>] [-n <value>] [-s <value>] [-x
<value> | -X <value>] [-e <value> | -R]
ARGUMENTS
RESOURCE the resource type
FLAGS
-D, --doc shows the CLI command in a specific language
-R, --raw print out the raw API response
-X, --save-path=<value> save command output to file and create missing path directories
-e, --extract=<value>... extract subfields from object attributes
-f, --fields=<value>... comma separeted list of fields in the format [resource]=field1,field2...
-i, --include=<value>... comma separated resources to include
-j, --json convert output in standard JSON format
-l, --lang=<option> show the CLI command in the specified language syntax
<options: curl|node>
-n, --pageSize=<value> number of elements per page
-o, --organization=<value> (required) the slug of your organization
-p, --page=<value> page number
-s, --sort=<value>... defines results ordering
-u, --unformatted print unformatted JSON output
-w, --where=<value>... comma separated list of query filters
-x, --save=<value> save command output to file
--curl show the equivalent cURL command of the CLI command
--load-args=<value> load previously saved command arguments
--node show the equivalent Node SDK source code of the CLI command
--save-args=<value> save command data to file for future use
DESCRIPTION
fetch a collection of resources
ALIASES
$ commercelayer list
$ commercelayer rl
$ commercelayer res:list
EXAMPLES
$ commercelayer resources:list customers -f id,email -i customer_group -s updated_at
$ cl res:list -i customer_group -f customer_groups/name -w customer_group_name_eq="GROUP NAME"
$ cl list -p 5 -n 10 -s -created_at --raw
See code: src/commands/resources/list.ts
commercelayer resources:retrieve RESOURCE [ID]
Fetch a single resource.
USAGE
$ commercelayer resources:retrieve [RESOURCE] [ID] -o <value> [-i <value>] [-f <value>] [-u -j] [-l curl|node -D]
[--curl ] [--node ] [--save-args <value>] [--load-args <value>] [-x <value> | -X <value>] [-e <value> | -R]
ARGUMENTS
RESOURCE the resource type
ID id of the resource to retrieve
FLAGS
-D, --doc shows the CLI command in a specific language
-R, --raw print out the raw API response
-X, --save-path=<value> save command output to file and create missing path directories
-e, --extract=<value>... extract subfields from object attributes
-f, --fields=<value>... comma separeted list of fields in the format [resource]=field1,field2...
-i, --include=<value>... comma separated resources to include
-j, --json convert output in standard JSON format
-l, --lang=<option> show the CLI command in the specified language syntax
<options: curl|node>
-o, --organization=<value> (required) the slug of your organization
-u, --unformatted print unformatted JSON output
-x, --save=<value> save command output to file
--curl show the equivalent cURL command of the CLI command
--load-args=<value> load previously saved command arguments
--node show the equivalent Node SDK source code of the CLI command
--save-args=<value> save command data to file for future use
DESCRIPTION
fetch a single resource
ALIASES
$ commercelayer retrieve
$ commercelayer rr
$ commercelayer res:retrieve
EXAMPLES
$ commercelayer resources:retrieve customers/<customerId>
$ commercelayer retrieve customers <customerId>
$ cl res:retrieve customers <customerId>
$ clayer rr customers/<customerId>
See code: src/commands/resources/retrieve.ts
commercelayer resources:update RESOURCE [ID]
Update an existing resource.
USAGE
$ commercelayer resources:update [RESOURCE] [ID] -o <value> [-i <value>] [-f <value>] [-u -j] [-R] [-l curl|node -D]
[--curl ] [--node ] [-O <value>] [-D <value> | -a <value> | -r <value> | [-m <value> | -M <value>] | | |
--load-args <value> | --save-args <value>]
ARGUMENTS
RESOURCE the resource type
ID id of the resource to update
FLAGS
-D, --data=<value> the data file to use as request body
-D, --doc shows the CLI command in a specific language
-M, --metadata-replace=<value>... define a metadata attribute and replace every item already presente in the remote
resource
-O, --object=<value>... define a resource object attribute
-R, --raw print out the raw API response
-a, --attribute=<value>... define a resource attribute
-f, --fields=<value>... comma separeted list of fields in the format [resource]=field1,field2...
-i, --include=<value>... comma separated resources to include
-j, --json convert output in standard JSON format
-l, --lang=<option> show the CLI command in the specified language syntax
<options: curl|node>
-m, --metadata=<value>... define a metadata attribute and merge it with the metadata already present in the
remote resource
-o, --organization=<value> (required) the slug of your organization
-r, --relationship=<value>... define a relationship with another resource
-u, --unformatted print unformatted JSON output
--curl show the equivalent cURL command of the CLI command
--load-args=<value> load previously saved command arguments
--node show the equivalent Node SDK source code of the CLI command
--save-args=<value> save command data to file for future use
DESCRIPTION
update an existing resource
ALIASES
$ commercelayer update
$ commercelayer ru
$ commercelayer res:update
$ commercelayer patch
EXAMPLES
$ commercelayer resources:update customers/<customerId> -a reference=referenceId
$ commercelayer res:update customers <customerId> -a reference_origin="Ref Origin"
$ cl update customers/<customerId> -m meta_key="meta value"
$ cl ru customers <customerId> -M meta_key="metadata overwrite
$ clayer update customers <customerId> -D /path/to/data/file/data.json
See code: src/commands/resources/update.ts