In an azure function I’m attempting to update an entity in dynamics:
public async Task UpdateEmployeeAsync(JObject employee)
{
var content = new StringContent(employee.ToString(), Encoding.UTF8, "application/json");
var response = await _httpClient.PostAsync($"/data/EmployeesV2", content);
response.EnsureSuccessStatusCode();
}
I’ve attempted something like this as well:
var response = await _httpClient.PostAsync($"/data/EmployeesV2/{employee["PersonnelNumber"]}", content);
Each time i get an internal server error
response.
I’ve attempted the same in Postman, with various types of requests:
PATCH
https://xxxxxxxxxxx.dynamics.com/data/EmployeesV2(PersonnelNumber='100059')
BODY
{
"FirstName": "xxx",
"LastName": "xxxx",
"PrimaryContactEmail": "xxxxxxxx.com",
"PersonnelNumber": "100059",
"EmploymentLegalEntityId": "0093",
"EmploymentStartDate": "2021-09-27T00:00:00-05:00",
"TitleId": "Chief Executive Officer"
}
The response I’m getting is:
{
"Message": "No HTTP resource was found that matches the request URI 'https://xxxxxxxxxxxx.dynamics.com/data/EmployeesV2(PersonnelNumber='100059')'. No route data was found for this request."
}
Any idea how to PATCH an EmployeeV2 entity in C#?