Edit 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 editing people, this data is as follows.
The below example demonstrates editing an EmpowerID Person by editing the Title attribute of a person.
Endpoint
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.
{
"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#
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
Be sure to use double quotes unless you are making hte request from a non-Windows OS.
Â
Ajax
Â
Response
If the request is successful, you should receive a JSON response that looks similar to that below:
Â
Postman Example
Open the Postman app on your machine.
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
.Click the Headers tab and add the above mentioned key/value pairs.
Click the Body tab, select raw and then add the below JSON. Change the values for the person you are editing.
Click Send.
If the request is successful, you should receive a JSON response that looks similar to that shown below.Â
Next Steps
Â
IN THIS ARTICLE