Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

To call invoke the API so that it performs the for executing operations or returns the retrieving data requested required by your application, you need to make initiate a POST request to the appropriate corresponding endpoint. When creating new resources like , such as an EmpowerID Person, you need to send a POST a request to the endpoint that starts associated with the EmpowerID Workflow service, passing to providing the API the necessary header and request data.

Prerequisites:

For creating an EmpowerID Person, this the required data is as follows.:

Endpoint

Code Block
https://{FQDN_OF_Your_EmpowerID_Web_Server}/api/services/v1/workflow/start

Headers

Key

Value

X-EmpowerID-API-Key

The API key for the OAuth application you created above.

Content-Type

application/json

Authorization

Bearer token

Request Data

Request data is sent to the API in JSON format. The data in the below request represents the minimum key/value pairs required for creating an EmpowerID Person. The API Reference includes all possible key/value pairs that can be submitted when creating people.

Info

OutputParameters are optional, but are useful for viewing the results of the operation.

Code Block
{
  "Name": "CreatePerson",
  "InputParameters":
  {
    "TargetPerson" :
    {
      "LastName": "Adams",
      "FirstName": "Samuel",
      "PrimaryOrgRoleOrgZoneID": "2"
    }
  },
  "OutputParameters": [{"TargetPerson": ["PersonID", "FirstName", "LastName"]}]
}

Element

Description

Type

Required

Name

Name of the workflow

String

Required

InputParameters

Workflow input

Data Object

Required

TargetPerson

Attributes of the person

Data Object

Required

Firstname

First name of the person

String

Required

LastName

Last name of the person

String

Required

PrimaryOrgRoleOrgZoneID

Primary Business Role and Location of the person

Integer

Required

OutputParameters

Workflow output

Data Object

Optional

Code Examples

In the examples, we are passing in the minimum number of parameters and requesting an output showing the PersonID, LastName and FirstName attributes of the person that is created by the operation.

C#

Code Block
languagec#
var url = "https://{FQDN_OF_Your_EmpowerID_Web_Server}/api/services/v1/workflow/start";
using (var webClient = new WebClient())
{
   webClient.Headers[HttpRequestHeader.Authorization] = String.Format(BearerHeaderFormat, {Your_Access_Token});
   webClient.Headers[ApiKeyHeader] = {Your_API_Key};
   webClient.Headers.Add(HttpRequestHeader.ContentType, "application/json");  
   var workflowInput = new WorkflowInput {Name = "CreatePerson"};
   workflowInput.InputParameters["TargetPerson"] = new
   {
      FirstName = "Samuel";
      LastName = "Adams";
      PrimaryOrgRoleOrgZoneID = 2; //Temporary Role in Temporary Location
   };
   workflowInput.OutputParameters.Add(new { TargetPerson = new[] {"PersonGUID", "PersonID", FirstName", "LastName"}});   
   var inputJsonData = Json.convert.SerializeObject(workflowInput);
   var jsonResult = webClient.UploadString(url, inputJsonData);
   
   //Write results to console if desired
   if(!String.IsNullOrWhiteSpace(jsonResult))
   {
      workflowOutput = JsonConvert.DeserializeObject<WorkflowOutput>(jsonResult);
      string results = workflowOutput.OutputParameters["TargetPerson"].ToString();
      Console.Write(results);
   }
}

cURL

Note

Be sure to use double quotes unless you are making hte request from a non-Windows OS.

Code Block
curl "https://{FQDN_Of_Your_EmpowerID_Web_Server}/api/services/v1/workflow/start" \
-X POST \
-H "X-EmpowerID-API-Key: {Your_API_Key} \
-H "Authorization: Bearer {OAuth_token_you_received_from_EmpowerID}" \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "{ \"Name\": \"CreatePerson\", \"InputParameters\": {\"TargetPerson\":{\"LastName\"" \"Adams\",
\"FirstName\": \"Samuel\", \"PrimaryOrgRoleOrgZoneID\" \"2\" }}, \"OutputParameters\": [{\"TargetPerson\":
[\"PersonID\", \"FirstName\", \"LastName\"]}]}"

Ajax

Code Block
languagejs
$.ajax({
  url: "https://{FQDN_OF_Your_EmpowerID_Web_Server}/api/services/v1/workflow/start",
  type: "POST",
  
 headers: {
    "X-EmpowerID-API-Key": "{Your_API_Key}",
    "Content-Type": "application/json",
    "Authorization": "Bearer {OAuth_token_you_received_from_EmpowerID
    }
  },
  
  data: JSON.stringify({
    "Name": "CreatePerson",
        "InputParameters":
        {
            "TargetPerson": {
            "FirstName": "Adams",
            "LastName" : "Samuel",
            "PrimaryOrgRoleOrgZoneID": "4980"
        }
    },
    "OutputParameters": [{"TargetPerson": ["PersonID", "FirstName", "LastName"]}]  
  
  })
})

Response

If the request is successful, you should receive a JSON response that looks similar to that below:

Code Block
languagejson
{
  "Id": 0,
  "Name": "CreatePerson",
  "InstanceId": "db14de5f-b8e4-4e61-a6a5-d17030e4a44f",
  "CorrelationId": "00000000-0000-0000-0000-000000000000",
  "UIType": "None",
  "UIName": "",
  "UIData": null,
  "OutputParameters": {
    "TargetPerson": {
      "PersonID": 402,
      "FirstName": "Samuel",
      "LastName": "Adams"
    }
  },
  "OutputTaskParameters": null,
  "WorkflowState": "Completed",
  "DeferredUntil": "0001-01-01T00:00:00",
  "Error": null
} 

Postman Example

  1. Open the Postman app on your machine.

  2. In Postman, open a new tab, select POST as the HTTP method and enter https://{FQDN_Of_Your_EmpowerID_Web_Server}/api/services/workflow/start.

  3. Click the Headers tab and add the above mentioned key/value pairs.

    Image Modified


  4. Click the Body tab, select raw, and then add the below JSON:

    Code Block
    languagejson
    {
      "Name": "CreatePerson",
      "InputParameters":
      {
        "TargetPerson" :
        {
          "LastName": "Adams",
          "FirstName": "Samuel",
          "PrimaryOrgRoleOrgZoneID": "2"
        }
      },
      "OutputParameters": [{"TargetPerson": ["PersonID", "FirstName", "LastName"]}]
    }

    Image Modified


  5. Click Send.

    If the request is successful, you should receive a JSON response that looks similar to that shown below.

    Code Block
    languagejson
    {
      "Id": 0,
      "Name": "CreatePerson",
      "InstanceId": "db14de5f-b8e4-4e61-a6a5-d17030e4a44f",
      "CorrelationId": "00000000-0000-0000-0000-000000000000",
      "UIType": "None",
      "UIName": "",
      "UIData": null,
      "OutputParameters": {
        "TargetPerson": {
          "PersonID": 381,
          "FirstName": "Samuel",
          "LastName": "Adams"
        }
      },
      "OutputTaskParameters": null,
      "WorkflowState": "Completed",
      "DeferredUntil": "0001-01-01T00:00:00",
      "Error": null
    }


Next Steps

Edit people

Reset passwords

Check access

Div
stylefloat: left; position: fixed;

IN THIS ARTICLE

Table of Contents
maxLevel4
minLevel2
stylenone


Insert excerpt
IL:External Stylesheet
IL:External Stylesheet
nopaneltrue