You have been redirected from an outdated version of the article. Below is the content available on this topic. To view the old article click here.

Command-Line Tools

Structr comes with a set of command-line tools to make interaction with the REST server more convenient.

Modes

There are two modes providing some scripts which are basically wrappers around curl:

  1. If you built Structr from source, the command-line tools are available in structr-ui/src/main/resources/bin and can be activated with the command . ./su. This will “source” the su script, adding parameters to the local shell environment, e.g. the URL of the REST server, username and password.

  2. If you extracted the distribution file (the one ending with -dist.zip), the scripts are available in the bin/ directory.

Provided Scripts

The following scripts are provided:

get "<url>"
put "<url>" '<data>'
post "<url>" '<data>'
delete "<url>"

Caveats

  • Please note that you need to have curl installed to be able to use the scripts.
  • Also note that you have to omit the parameter -d when sending data as JSON body.
  • <url> should always be in double quotes to avoid issues with the & character
  • <data> has to be valid JSON data: ‘[…]’ or ‘{…}’

Examples

Some example usages of the provided scripts:

Issue a GET request to the User resource to list all users in the system

get users

Return the user with name = ‘foo’

get users?name=foo

Set a new password for the given user

put user/f6c7be79f5e24ece93eef4b597e7ba34 '{password:myNewPassword}'

Start rebuilding the index

post maintenance/rebuildIndex '{}'

Related resources

Search results for "Command-Line Tools"

We could not find anything matching "Command-Line Tools" in our documentation. Please rephrase your search.

You can also ask your questions in the Structr Google Group or create a free account in the Structr Support Portal.
Click here to send feedback to the Structr team.