PingOne Platform APIs

Start Flow

POST {{authPath}}/{{envID}}/davinci/policy/{{davinciFlowPolicyID}}/start

The following sample shows the start flow endpoint, POST {{authPath}}/{{envID}}/davinci/policy/{{davinciFlowPolicyID}}/start, which initates the flow specified by the flow policy ID in the request URL. In this case, the {{davinciFlowPolicyID}} corresponds to a sign-on flow included in the flow policy that prompts the user for a username and password.

Before you use this endpoint, refer to Initiating Flow Policies to determine if the /start endpoint on the {{authPath}} resource server is the best option for your flow.

This flow does not have an associated input schema, so there are no input schema properties specified in the request.

An application can be associated with several flow policies. The flow policy ID provided in the request URL determines which flow is initiated. For example, if the application has two flow policies, one for sign-on with a username and password (login policy) and one for user registration (registration policy), the /start operation can specify one or the other, depending on the user action. If the user clicks the application’s SIGN-ON button, the application initiates the POST {{authPath}}/{{envID}}/davinci/policy/{{policyID}}/start flow associated with the login policy. If the user clicks the REGISTER button, the application initiates the POST {{authPath}}/{{envID}}/davinci/policy/{{policyID}}/start flow associated with the registration policy. These policies present different forms to prompt the user for required information to complete the flow.

Prerequisites

Headers

Authorization      Bearer {{accessToken}}

Example Request

  • cURL

  • C#

  • Go

  • HTTP

  • Java

  • jQuery

  • NodeJS

  • Python

  • PHP

  • Ruby

  • Swift

curl --location --globoff --request POST '{{authPath}}/{{envID}}/davinci/policy/{{davinciFlowPolicyID}}/start' \
--header 'Authorization: Bearer {{accessToken}}'
var options = new RestClientOptions("{{authPath}}/{{envID}}/davinci/policy/{{davinciFlowPolicyID}}/start")
{
  MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("", Method.Post);
request.AddHeader("Authorization", "Bearer {{accessToken}}");
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);
package main

import (
  "fmt"
  "net/http"
  "io"
)

func main() {

  url := "{{authPath}}/{{envID}}/davinci/policy/{{davinciFlowPolicyID}}/start"
  method := "POST"

  client := &http.Client {
  }
  req, err := http.NewRequest(method, url, nil)

  if err != nil {
    fmt.Println(err)
    return
  }
  req.Header.Add("Authorization", "Bearer {{accessToken}}")

  res, err := client.Do(req)
  if err != nil {
    fmt.Println(err)
    return
  }
  defer res.Body.Close()

  body, err := io.ReadAll(res.Body)
  if err != nil {
    fmt.Println(err)
    return
  }
  fmt.Println(string(body))
}
POST /{{envID}}/davinci/policy/{{davinciFlowPolicyID}}/start HTTP/1.1
Host: {{authPath}}
Authorization: Bearer {{accessToken}}
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
  .url("{{authPath}}/{{envID}}/davinci/policy/{{davinciFlowPolicyID}}/start")
  .method("POST", body)
  .addHeader("Authorization", "Bearer {{accessToken}}")
  .build();
Response response = client.newCall(request).execute();
var settings = {
  "url": "{{authPath}}/{{envID}}/davinci/policy/{{davinciFlowPolicyID}}/start",
  "method": "POST",
  "timeout": 0,
  "headers": {
    "Authorization": "Bearer {{accessToken}}"
  },
};

$.ajax(settings).done(function (response) {
  console.log(response);
});
var request = require('request');
var options = {
  'method': 'POST',
  'url': '{{authPath}}/{{envID}}/davinci/policy/{{davinciFlowPolicyID}}/start',
  'headers': {
    'Authorization': 'Bearer {{accessToken}}'
  }
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});
import requests

url = "{{authPath}}/{{envID}}/davinci/policy/{{davinciFlowPolicyID}}/start"

payload = {}
headers = {
  'Authorization': 'Bearer {{accessToken}}'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)
<?php
require_once 'HTTP/Request2.php';
$request = new HTTP_Request2();
$request->setUrl('{{authPath}}/{{envID}}/davinci/policy/{{davinciFlowPolicyID}}/start');
$request->setMethod(HTTP_Request2::METHOD_POST);
$request->setConfig(array(
  'follow_redirects' => TRUE
));
$request->setHeader(array(
  'Authorization' => 'Bearer {{accessToken}}'
));
try {
  $response = $request->send();
  if ($response->getStatus() == 200) {
    echo $response->getBody();
  }
  else {
    echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
    $response->getReasonPhrase();
  }
}
catch(HTTP_Request2_Exception $e) {
  echo 'Error: ' . $e->getMessage();
}
require "uri"
require "net/http"

url = URI("{{authPath}}/{{envID}}/davinci/policy/{{davinciFlowPolicyID}}/start")

http = Net::HTTP.new(url.host, url.port);
request = Net::HTTP::Post.new(url)
request["Authorization"] = "Bearer {{accessToken}}"

response = http.request(request)
puts response.read_body
var request = URLRequest(url: URL(string: "{{authPath}}/{{envID}}/davinci/policy/{{davinciFlowPolicyID}}/start")!,timeoutInterval: Double.infinity)
request.addValue("Bearer {{accessToken}}", forHTTPHeaderField: "Authorization")

request.httpMethod = "POST"

let task = URLSession.shared.dataTask(with: request) { data, response, error in
  guard let data = data else {
    print(String(describing: error))
    return
  }
  print(String(data: data, encoding: .utf8)!)
}

task.resume()

Example Response

200 OK

{
    "id": "howu8n9hsc",
    "companyId": "abfba8f6-49eb-49f5-a5d9-80ad5c98f9f6",
    "flowId": "3e0603680cbde668577a5eacc6c22987",
    "connectionId": "867ed4363b2bc21c860085ad2baa817d",
    "capabilityName": "customHTMLTemplate",
    "screen": {
        "name": "HTTP",
        "properties": {
            "sktemplate": {
                "type": "string",
                "displayName": "Template",
                "createdDate": 1657665418265,
                "customerId": "ecb9bf8a2fab854e65045d02cb6bab50",
                "companyId": "singularkey"
            },
            "customHTML": {
                "type": "string",
                "displayName": "HTML Template",
                "createdDate": 1657665418205,
                "customerId": "ecb9bf8a2fab854e65045d02cb6bab50",
                "companyId": "singularkey",
                "preferredControlType": "textArea",
                "enableParameters": true,
                "maximizeToggle": true,
                "viewToggle": true,
                "largePayload": true,
                "value": "<div class=\"app-container\" style=\"display: block;\">\n\t<div class=\"page__content\" style=\"height: 100%;\">\n\t\t<div class=\"card card--no-padding\">\n\t\t\t<div class=\"card__content\">\n\t\t\t\t<div class=\"org-logo\">\n\t\t\t\t\t<img class=\"org-logo__image\" src=\"https://d3uinntk0mqu3p.cloudfront.net/branding/market/a3d073bc-3108-49ad-b96c-404bea59a1d0.png\" alt=\"Company Logo\" />\n\t\t\t\t</div>\n\t\t\t\t<div data-skcomponent=\"skerror\" class=\"feedback feedback--error sk-alert sk-alert-danger has-text-danger has-background-danger-light\" data-id=\"feedback\" data-skvisibility=\"\"></div>\n\t\t\t\t<form class=\"form\" id='usernamePasswordForm' data-id=\"usernamePasswordForm\">\n\t\t\t\t\t<div class=\"field float-label\">\n\t\t\t\t\t\t<input class=\"text-input float-label__input\" data-id=\"username-input\" id=\"username\" name=\"username\" type=\"text\" autocomplete=\"on\" value=\"\" />\n\t\t\t\t\t\t<label class=\"float-label__label\" for=\"username\">Username</label>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div class=\"field float-label\">\n\t\t\t\t\t\t<input class=\"text-input text-input--pasword float-label__input\" data-id=\"password-input\" id=\"password\" name=\"password\" type=\"password\" autocomplete=\"on\" value=\"\" />\n\t\t\t\t\t\t<label class=\"float-label__label\" for=\"password\">Password</label>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div class=\"control\">\n\t\t\t\t\t\t<button class=\"field is-primary mt-2 button file-input--button button--primary brand-primary-bg\" data-id=\"button\" type=\"submit\" data-skcomponent=\"skbutton\" data-skbuttontype=\"form-submit\" data-skform=\"usernamePasswordForm\" data-skbuttonvalue=\"submit\">\n                            Sign On\n\t\t\t\t\t\t\t<i class=\"fas fa-forward ml-2\"></i>\n\t\t\t\t\t\t</button>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div class=\"control\">\n                        <div style=\"width: 100%; text-align: center;\">\n                            <button type=\"submit\" class=\"buttonLink is-primary is-inverted mt-2\" data-skcomponent=\"skbutton\" data-skbuttontype=\"form-submit\" data-skform=\"usernamePasswordForm\" data-skbuttonvalue=\"forgotPassword\">\n                                Forgot Password\n                                <i class=\"fas fa-forward ml-2\"></i>\n                            </button>\n                        </div>\n\t\t\t\t\t</div>\n\t\t\t\t</form>\n\t\t\t</div>\n\t\t</div>\n\t</div>\n</div>\n"
            },
            "validationRules": {
                "type": "object",
                "displayName": "Form validation rules",
                "value": [],
                "info": "Rules to check to validate form inputs",
                "createdDate": 1657665418203,
                "customerId": "ecb9bf8a2fab854e65045d02cb6bab50",
                "companyId": "singularkey",
                "preferredControlType": "validationRules"
            },
            "customCSS": {
                "type": "string",
                "displayName": "CSS",
                "createdDate": 1657665418313,
                "customerId": "ecb9bf8a2fab854e65045d02cb6bab50",
                "companyId": "singularkey",
                "preferredControlType": "codeEditor",
                "language": "css",
                "maximizeToggle": true,
                "largePayload": true
            },
            "customScript": {
                "type": "string",
                "displayName": "Script",
                "createdDate": 1657665418314,
                "customerId": "ecb9bf8a2fab854e65045d02cb6bab50",
                "companyId": "singularkey",
                "preferredControlType": "codeEditor",
                "value": "",
                "language": "javascript",
                "maximizeToggle": true
            },
            "inputSchema": {
                "type": "string",
                "displayName": "Input Schema",
                "createdDate": 1657665418286,
                "customerId": "ecb9bf8a2fab854e65045d02cb6bab50",
                "companyId": "singularkey",
                "preferredControlType": "codeEditor",
                "language": "json",
                "info": "Follow example for JSON schema.",
                "maximizeToggle": true
            },
            "outputSchema": {
                "type": "string",
                "displayName": "Output Schema",
                "createdDate": 1657665418168,
                "customerId": "ecb9bf8a2fab854e65045d02cb6bab50",
                "companyId": "singularkey",
                "preferredControlType": "codeEditor",
                "language": "json",
                "info": "Follow example for JSON schema.",
                "maximizeToggle": true
            },
            "formFieldsList": {
                "type": "array",
                "constructType": "formFieldsList",
                "displayName": "Output Fields List",
                "createdDate": 1657665418278,
                "customerId": "ecb9bf8a2fab854e65045d02cb6bab50",
                "companyId": "singularkey",
                "preferredControlType": "formFieldsList",
                "hideLabel": false,
                "value": [
                    {
                        "preferredControlType": "textField",
                        "preferredDataType": "string",
                        "propertyName": "username",
                        "displayName": "Username",
                        "hashedVisibility": false
                    },
                    {
                        "preferredControlType": "textField",
                        "preferredDataType": "string",
                        "propertyName": "password",
                        "displayName": "Password",
                        "hashedVisibility": true
                    },
                    {
                        "preferredControlType": "textField",
                        "preferredDataType": "string",
                        "propertyName": "buttonValue"
                    }
                ]
            },
            "challenge": {
                "type": "string",
                "displayName": "Challenge",
                "createdDate": 1657665418279,
                "customerId": "ecb9bf8a2fab854e65045d02cb6bab50",
                "companyId": "singularkey",
                "preferredControlType": "textField",
                "enableParameters": true
            },
            "button": {
                "constructType": "button",
                "displayName": "Submit",
                "createdDate": 1657665418275,
                "customerId": "ecb9bf8a2fab854e65045d02cb6bab50",
                "companyId": "singularkey",
                "logo": "",
                "showLogo": true,
                "preferredControlType": "button",
                "css": {
                    "backgroundColor": "#1CAB42",
                    "color": "#ffffff"
                },
                "onClick": {
                    "constructType": "skEvent",
                    "eventName": "continue",
                    "params": [],
                    "eventType": "post",
                    "postProcess": {}
                }
            },
            "nodeTitle": {
                "value": "Username/Password Form"
            }
        },
        "userViews": [
            {
                "screenTemplateName": "CustomHTMLTemplate",
                "items": [
                    {
                        "propertyName": "sktemplate"
                    },
                    {
                        "propertyName": "customHTML"
                    },
                    {
                        "propertyName": "validationRules"
                    },
                    {
                        "propertyName": "customCSS"
                    },
                    {
                        "propertyName": "customScript"
                    },
                    {
                        "propertyName": "inputSchema"
                    },
                    {
                        "propertyName": "outputSchema"
                    },
                    {
                        "propertyName": "formFieldsList"
                    },
                    {
                        "propertyName": "challenge"
                    },
                    {
                        "propertyName": "button"
                    }
                ]
            }
        ],
        "metadata": {
            "colors": {
                "canvas": "#AFD5FF",
                "canvasText": "#253746",
                "dark": "#2E5EA6"
            },
            "logos": {
                "canvas": {
                    "imageFileName": "http.svg"
                }
            }
        }
    },
    "interactionId": "03b9c80f-0f33-4cc7-bd69-e4b2333db89c",
    "interactionToken": "49da59305bec66faeafee2947ca0aabb99fc130cfa4ee051a4f1c417c236edabb1bbc3a3065d0eb8b5af853e4ffda70a42d6b8f493d5e72ea166d4d04ea8b06116aae8b228666809d172249cd265092c58682f7d349169ff9371e20798590ce55e221ba2f1be51e625741f1caf19767e221b692c5984267f14d5a05fe82e067e",
    "skProxyApiEnvironmentId": "us-west-2"
}