Jump to content
Froxlor Forum
  • 0

How to use froxlor-cli for api-calls / how to provide parameters?


Question

Posted

Can someone please tell me how to use the froxlor-cli for api-calls e.g. to add a customer?

I tried the following and several other ways to provide the parameters but it doesn't seem to work.

bin/froxlor-cli froxlor:api-call -s froxlor Customers.add  '{"email": "mail@example.com", "company": "example-inc", "new_loginname": "example"}'

Thanks in advance!

3 answers to this question

Recommended Posts

  • 0
Posted
Just now, nebulo said:

am struggling with how to provide the parameters in the array.

As stated in the --help output of the command:
 

parameters            Paramaters to pass to the command as JSON array

Dont see where you are doing anything wrong, looks ok to me (and you've stated that the following works...)

  • 0
Posted

`-s` = show parameters, that won't run the `Customers.add` API call.

The commands call is the following:

froxlor:api-call [options] [--] <user> <api-command> [<parameters>]

Also:

Arguments:
  user                  Loginname of the user you want to run the command as
  api-command           The command to execute in the form "Module.function"
  parameters            Paramaters to pass to the command as JSON array

The API doc for adding customers can be found here: https://docs.froxlor.org/latest/api-guide/commands/customers.html#customers-add

  • 0
Posted

Thanks for the amazing fast feedback!

Of course the '-s' is a mistake but I struggeled with how to provide the parameters in the array.

Just for documentation: The following works.

Quote

froxlor-cli froxlor:api-call froxlor Customers.add '{"email": "info@example.com", "company": "example inc", "new_loginname": "example"}'

 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


×
×
  • Create New...