FastTrack

From DreamFactory
Jump to: navigation, search
DFEConsoleFastTrack
m
m
Line 20: Line 20:
 
==== http[s]://console.dfe.example.com/fast-track ====
 
==== http[s]://console.dfe.example.com/fast-track ====
  
This is the main endpoint that receives the '''POST''' from a _landing page_ and performs the above outlined operations. The route to this endpoint defaults to <code>/fast-track</code>, however this can be changed in the <code>.env</code> file. See [[DFE/Configuration]] for more information about customizing the environment.
+
This is the main endpoint that receives the '''POST''' from a _landing page_ and performs the above outlined operations. The route to this endpoint defaults to <code>/fast-track</code>, however this can be changed in the <code>.env</code> file. See [[DFE/Configuration#FastTrack_Settings]] for more information about customizing the environment.
  
 
==== http[s]://instance-name.dfe.example.com/instance/fast-track ====
 
==== http[s]://instance-name.dfe.example.com/instance/fast-track ====

Revision as of 23:02, 26 February 2016

Introduction

The FastTrack system is intended to provide a one-click entry into a DreamFactory%trade; instance.

Calling this endpoint performs the following operations:

  1. Validates the request
  2. A DFE Dashboard user is created with the provided information
  3. An instance is created named using a portion of the email address
  4. The instance is initialized and the database is created
  5. An instance admin is created on the new instance
  6. The browser is optionally redirected to the login page of the new instance

In the future, the user can be automatically logged in to the instance instead.

The Endpoints

FastTrack has two endpoints. The main one is part of DFE Console. The second being the auto-login endpoint within managed DreamFactory™ instances.

The FastTrack endpoint depends on the domain name of your DFE installation. We'll use dfe.example.com as our domain name in this documentation.

http[s]://console.dfe.example.com/fast-track

This is the main endpoint that receives the POST from a _landing page_ and performs the above outlined operations. The route to this endpoint defaults to /fast-track, however this can be changed in the .env file. See DFE/Configuration#FastTrack_Settings for more information about customizing the environment.

http[s]://instance-name.dfe.example.com/instance/fast-track

The second endpoint is provided by any DreamFactory™ instance under DFE management. This route accepts a single query parameter fastTrackGuid.

The fastTrackGuid is generate by the DFE Console during the initial FastTrack operations. This GUID allows the instance to validate that the login request came from the console. Currently, this just redirects the browser to the instance login page. In the future, it will be able to log the user directly into the instance.

Using FastTrack

You must call the first FastTrack endpoint using an HTTP POST with a JSON payload.

The endpoint to call for this example is http://console.dfe.example.com/fast-trak.

The Payload

The payload may contain the following properties:

{
  "email":      "[email protected]",
  "first-name": "Joe",
  "last-name":  "Blow",
  "password":   "[email protected]!",
 
  "redirect":   true|false,
  "company":    "company name",
  "phone":      "phone number"
  "nickname":   "Joe",
}

The email, first-name, last-name, and email fields are required. redirect, company, nickname and phone are optional.

If the process is successful and redirect is true, the response will be a 302 HTTP redirect directly to the newly launched instance's FastTrack endpoint (see above). Otherwise, a standard DFE Console API response will be returned. Responses are detailed in the following sections.

Success Response

{
    "success":     true,
    "status_code": 200,
    "response": {
        "user": {
            "id": 123,
            ...
        },
        "instance-id": "joe",
        "instance":    {
            "id": 123
            ...
        },
        "instance-initialized": true,
        "instance-admin":       true,
        "redirect":             {
            "location":           "redirect-uri",
            "status-code":        302,
            "payload": {
                "fastTrackGuid":    "new user's registration request GUID"
            }
        }
    },
    "request": {
        "elapsed":     37.3943,
        "id":          "102fb7bff406b58eca8f8499f461f64204f62ba1",
        "request-uri": "/fast-track",
        "signature":   "oofbIbnrWJq04/+4/K/q9eyDzB71UxZ19huyaDVfbMA=",
        "start":       "2016-02-25T16:32:08-05:00",
        "verb":        "POST"
        "version":     "2.0"
    }
}
Partial Success Response
{
    "success":     true,
    "status_code": 200,
    "response": {
        "user": false|{
            "id": 123,
            ...
        },
        "instance-id": false|"joe",
        "instance":    false|{
            "id": 123
            ...
        },
        "instance-initialized": false|true,
        "instance-admin":       false|true,
        "redirect":             false|{
            "location":           "redirect-uri",
            "status-code":        302,
            "payload": {
                "fastTrackGuid":    "new user's registration request GUID"
            }
        }
    },
    "request": {
        "elapsed":     37.3943,
        "id":          "102fb7bff406b58eca8f8499f461f64204f62ba1",
        "request-uri": "/fast-track",
        "signature":   "oofbIbnrWJq04/+4/K/q9eyDzB71UxZ19huyaDVfbMA=",
        "start":       "2016-02-25T16:32:08-05:00",
        "verb":        "POST"
        "version":     "2.0"
    }
}

Error Response

{
    "success":     false,
    "status_code": 400|404|500,
    "error": {
        "code":    400|404|500,
        "message": "I am an error message"
    },
    "response": null,
    "request": {
        "elapsed":     0.1109,
        "id":          "664d18cd422c5968f603f8fe8f928524220b5855",
        "request-uri": "/fast-track",
        "signature":   "noERPor0Lg76mXDWJ1gsmisueBL5psl6fszpsuqE98A=",
        "start":       "2016-02-25T16:21:25-05:00",
        "verb":        "POST"
        "version":     "2.0"
    }
}