REST service that provides an interface to update the PEAssocDetail table
using System.Net;
using Newtonsoft.Json.Linq;
public void MethodName(parms){
string uniqueKey = "sdfJlk";
string uri = $"https://fusion.superion.com/FusionOSServices/v2/ONESolution/PersonEntity/PEAssocDetail?uniqueKey={uniqueKey}";
string data =
@"[{
""peId"": ""104202"",
""assocCd"": ""1042RECP"",
""codeVal"": ""02"",
""codeDesc"": ""aerthf"",
""uniqueKey"": ""a5a70f0e-457f-11d9-825d-00306e2c5246"",
""codeNum"": ""0.00000"",
""codeDt"": """",
""createWhen"": """",
""createWho"": """",
""updateWhen"": ""10/2/2020 8:10:35 PM"",
""updateWho"": ""RESTAPI""
}]";
using (WebClient wc = new WebClient())
{
wc.Headers.Add("Content-Type", "application/json");
// Replace "ID" with supplied AppID
wc.Headers.Set("X-APPID", "ID");
// Replace "KEY" with supplied AppKey
wc.Headers.Set("X-APPKEY", "KEY");
string result = wc.UploadString(uri, "PUT", data);
JObject response;
if (!string.IsNullOrWhiteSpace(result))
response = JObject.Parse(result);
}
}
Since PEAssocDetail is unusual in that its uniqueKey field is the only one which must be distinct and unique among all records in the table, the record to update is specified by the uniqueKey of that record, which is supplied in the URL's query string. If a corresponding record exists, that record will be updated with the data in the request body. The body should contain the same uniqueKey as the query string. The JSON body can be copied from a GET and altered as needed. Errors are returned as JSON objects with messages in the #text attribute, e.g.: { "#text": "Cannot find Record to update" }