Command-Line Tools

Search
Feedback

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

Graph-Browser

Related Articles
About this article
Last change 2017-05-04
Topics Structr 2.0