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.

Resources

Search results for "Resources"

HTTP Methods

A DELETE request tells the server to delete the contents of the location in the request URL. DELETE can be invoked on Collection Resources and Entity Resources. When the target URL refers to a Collection Resource, all objects that belong to the collection are deleted.

REST Endpoints

All REST Endpoints in Structr share the same base path, /structr/rest relative to the base URL of your Structr installation. There are two types of REST endpoints in Structr.

Depending on the type of resource, different request methods (GET, PUT, POST, PATCH, DELETE) are allowed.

Overview

Structr automatically creates REST endpoints for all types in the data model. There are different types of endpoints: collection resources, which provide access to collections of objects of the corresponding type, and entity resources that allow you to read, update or delete individual objects. To learn more about the basics of REST APIs in Structr, please read the chapter about the Structr REST API in the Fundamental Concepts document.

Entity Resources

Entity resources support view selection exactly like collection resources, so if you want to select the example view of a project, you can do it like in the following examples.

User Interface

To manage the user interface, Structr provides a visual web application builder. With the builder, you can either import HTML application templates or individual pages from a URL, or create everything from scratch. The resources (like CSS files, Javascript files, or images etc.) are downloaded automatically and stored in the Structr Filesystem, protected by the same access control and authentication layers as the rest of the data.

Apple macOS

  1. Download the file ending with -dist.zip from https://structr.com/resources/download.

  2. Open a terminal, cd to the Download folder and extract the downloaded file:
    unzip structr-<version>-dist.zip

  3. Enter the directory which has been created
    cd structr-<version>

  4. Start Structr
    bin/start
    You should see the following console output:

The building blocks

  • data access via REST endpoints
  • integrated authentication and access control
  • a filesystem to store documents, images and resources
  • large scripting library
  • predefined object types to use and extend

Resource Access Grants

You can see that access to the User collection was denied. If you look at the log file, you can see that there is a warning message because access to resources without authentication is prohibited by default.

Create and use Let's Encrypt certificates

The built-in Let’s Encrypt client tries to start its own HTTP server listening on port 80 when the http challenge type is used. If Structr’s internal web server is also configured to port 80, this will fail and the challenge response is then served from Structr’s internal virtual file system. The resources under /.well-known/acme-challenge/ will be removed automatically afterwards.

HTTP Methods

A POST request tells the server to invoke the function that is associated with the location in the request URL. In Structr, a POST request can invoke two different functions, based on the target resource in the URL.

  • If the target resource is a Collection Resource, a POST request will create a new object in that collection.
  • If the target resource is an Entity Resource that points to a schema method, the method is executed. Any parameters present in the request body will be passed to the method.
  • All other resources will return HTTP status 405 Method Not Allowed.

Collection Resources

Collection Resources are HTTP URLs that provide access to a collection of database objects, either nodes or relationships. The path of the resource is determined by the desired type, i.e. you can find the collection of Project nodes in the database at /structr/rest/Project.

Entity Resources

Entity Resources are HTTP URLs that provide access to a single object or function. Entity resource URLs usually end with a UUID to address an object, or the name of a function to invoke. They do not support pagination, sorting or filtering, because they usually contain only a single object.

Collection Resources

Most collection resources in Structr support GET, POST and PATCH for data retrieval, creation and bulk modification of objects, as shown in the following examples.

Maintenance

maintenance.application.http.port HTTP port the Structr server will listen on in maintenance mode.
maintenance.application.https.port HTTPS port the Structr server will listen on in maintenance mode.
maintenance.application.ssh.port SSH port the Structr server will listen on in maintenance mode.
maintenance.application.ftp.port FTP port the Structr server will listen on in maintenance mode.
maintenance.resource.path The local folder for static resources served in maintenance mode. If no path is provided, a default maintenance page with customizable text is shown in maintenance mode.
maintenance.message Text for default maintenance page.