Editing People

Editing People

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 creating an EmpowerID Person, this data is as follows.

The below example demonstrates editing an EmpowerID Person by editing the Title attribute of the person created in the above example.

Endpoint

api/services/v1/workflow/start

 

Headers

Key

Value

Key

Value

X-EmpowerID-API-Key

The API key for the OAuth application you created above.

Authorization

The OAuth token you received from EmpowerID.

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.

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

 

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

 

 

Element

Description

Type

Required

Note

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.

Code Examples

cURL

The following shows an example of editing a Person using cURL.

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

 

Request

curl "https://{FQDN_Of_Your_EmpowerID_Web_Server}/api/services/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\"" \"402\", \"Title\": \"Book Manager\" }}, \"OutputParameters\": [{\"TargetPerson\": [\"PersonID\", \"FirstName\", \"LastName\", \"Title\"]}]}"

 

Response

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

{ "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:

    { "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.

 

On this page