Versions Compared

Key

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

To call the API so that it performs the operations or returns the data requested by your application, you need to make a POST request to the appropriate endpoint. When creating new resources like an EmpowerID Person, you need to POST a request to the endpoint that starts the EmpowerID Workflow service, passing to the API the necessary header and request data. For editing people, this data is as follows.

The below example demonstrates editing an EmpowerID Person by editing the Title attribute of a person.

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

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 editing an EmpowerID Person. The API Reference includes all possible key/value pairs that can be submitted when creating people.

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

Code Block
languagejson
{
  "Name": "EditPerson",
  "InputParameters":
  {
    "TargetPerson" :
    {
      "PersonID": "381",
      "Title": "Pre-sales Engineer"
    }
  },
  "OutputParameters": [{"TargetPerson": ["PersonID", "FirstName", "LastName", "Title"]}]
}

Element

Description

Type

Required

Note

Name

Name of the workflow

String

Required

InputParameters

Workflow input

Data Object

Required

TargetPerson

Specifies the object of the operation

Data Object

Required

PersonID

ID of the person

Integer

Required

Title

Attribute being edited

String

Required

At least one attribute needs to be edited. In this example, Title is the attribute. You add each attribute being edited to the request.

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 edited attribute of the person. Change the input parameters as needed.

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
   {
      PersonID = 185809; 
      Title = "Pre-Sales Engineer";      
   };
   workflowInput.OutputParameters.Add(new { PargetPerson = new[] {"PersonGUID", "PersonID", FirstName", "LastName", "Title"}});   
   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\": \"EditPerson\", \"InputParameters\": {\"TargetPerson\":{\"PersonID\"" \"185809\",
\"Title\": \"Pre-Sales Engineer\" }}, \"OutputParameters\": [{\"TargetPerson\":
[\"PersonGUID\",\"PersonID\", \"FirstName\", \"LastName\", \"Title\"]}]}"

 

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": "EditPerson",
        "InputParameters":
        {
            "TargetPerson": {
            "PersonID": "185809",
            "Title" : "Pre-Sales Engineer"
        }
    },
    "OutputParameters": [{"TargetPerson": ["PersonGUID", PersonID", "FirstName", "LastName", "Title"]}]  
  
  })
})

 

Response

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

Code Block
languagejson
{
    "Id": 0,
    "Name": "EditPerson",
    "PersonId": 351,
    "InstanceId": "dcc1e525-5d01-48cf-aa7e-d7da1697237f",
    "CorrelationId": "fef9ba33-4768-4910-a4cd-b79ebcf91ff0",
    "UIType": "None",
    "UIName": null,
    "UIData": null,
    "OutputParameters": {},
    "OutputTaskParameters": {
        "Title": "Operation Execution Summary",
        "Description": null,
        "Message": "",
        "MessageType": "Info",
        "DisplayLength": 5000,
        "BubbleType": "None",
        "MessagesList": {
            "NodeValue": "Operation Execution Summary",
            "ChildNodes": [
                {
                    "NodeValue": "Edit Person: Adams, Samuel Name Attributes was executed successfully.",
                    "ChildNodes": []
                },
                {
                    "NodeValue": "Unlock Person Adams, Samuel was executed successfully.",
                    "ChildNodes": []
                },
                {
                    "NodeValue": "Edit Person Adams, Samuel Job Title was executed successfully.",
                    "ChildNodes": []
                }
            ]
        },
        "ShowInBubble": false,
        "FormDecision": "Requested",
        "SelectedOperations": null,
        "DecisionList": [
            {
                "BusinessProcessTaskSlotResponseTypeID": 11,
                "Name": "Submit",
                "FriendlyName": "Submit",
                "LocaleKeyEntryName": "EmpowerIDApplicationCommonWords_Submit",
                "Description": "The form was submitted",
                "ConfigurationXml": null,
                "CreatedDate": "2008-02-04T15:21:00",
                "ModifiedDate": "2008-02-04T15:21:00",
                "IsGridSelected": false
            }
        ],
        "WaitForResponse": true,
        "HideWaitForResultsCheckbox": true,
        "EnableBulkApproval": true,
        "CurrentBusinessProcessID": 23,
        "ShowAgreements": false,
        "ShowCommentsHistory": true,
        "CommentsHistory": [],
        "ShowComments": false,
        "AgreementsText": null,
        "Comments": 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.


  4. Click the Body tab, select raw and then add the below JSON. Change the values for the person you are editing.

    Code Block
    languagejson
    {
      "Name": "EditPerson",
      "InputParameters":
      {
        "TargetPerson" :
        {
          "PersonID": "381",
          "Title": "Pre-sales Engineer"
        }
      },
      "OutputParameters": [{"TargetPerson": ["PersonID", "FirstName", "LastName", "Title"]}]
    }



  5. Click Send.

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


Next Steps

Reset passwords

Check accessDelete people

Div
stylefloat: left; position: fixed;

IN THIS ARTICLE

Table of Contents
minLevel2
maxLevel4
stylenone

Insert excerpt
IL:External Stylesheet
IL:External Stylesheet
nopaneltrue