Typical Use Case

Typical endpoints are defined with this graph:

Typical Graph

This endpoint allows to define a custom implementation. Custom nodes should be put in between the Incoming Request Event node and the Send Response node.

Used nodes:

  • On Start: Unity node that executes the graph when the scene is started.
  • Game Object: Unity node to inject the Game Object with the Rest Server component on it.
  • Rest Server Reference: Injects the Rest Server component into the execution path, so the Endpoint Definition nodes can access it easily.
  • Endpoint Definition: Defines the endpoint with the path “/method_02”. Further endpoints can be defined when connected to “Not Request Trigger”.
  • Incoming Request Event: Execution path that is called, when a request for the connected Endpoint Definition is received. After this node the actual implementation for this request should be implemented.
  • Send Response: Important to send the caller a response back, even if it’s “just” a 200/ok. When a response isn’t sent back inside the timeout (default 2s, defined on the Endpoint Definition), a 500/internal server error is sent back.

Auto Endpoint

Auto endpoints are default implementations with specified functionality. The automatically are called and send responses back. Their definition is much easier and like depicted in this picture below.

Typical Graph for an Autoendpoint

Used nodes:

  • On Start: Unity node that executes the graph when the scene is started.
  • Game Object (1): Unity node to inject the Game Object with the Rest Server component on it.
  • Rest Server Reference: Injects the Rest Server component into the execution path, so the Endpoint Definition nodes can access it easily.
  • Transform Auto Endpoint: Endpoint which provides a specific interface on the path “/” (See Node Reference for information).
  • Game Object (2): Reference to the Game Object the auto endpoint should operate on.