I am using Microsoft Dynamics 365 and to access its database I am using Web API approach.
In here, I am having a field which is of lookup type and is having lookup values like below:
In here, consider its code values as below:
Pending: 101
Booked : 102
...
And what I am passing as JSON data is:
{
"statuscode":"101"
}
I have also tried like below:
"statuscode":101
"statuscode":"Booked"
But none of them is working for me. Can someone guide me on this?
EDIT 1: PUT Request
[ { "statuscode":101, "statecode":0 }, { "statuscode":101, "statecode":0 } ]
StringBuilder requestURL;
requestURL = new StringBuilder();
requestURL.Append(GenerateRequestURL(entityName));
requestURL.Append("(" + strGuID + ")");
HttpContent content = new StringContent(jsonFormattedData, Encoding.UTF8, "application/json");
Dictionary<string, string> returnValue;
HttpResponseMessage responseMessage;
returnValue = new Dictionary<string, string>();
try
{
HttpClient httpClient = SetUpCRMConnection();
HttpRequestMessage request;
request = new HttpRequestMessage(httpMethod, requestUrl);
request.Content = content;
responseMessage = httpClient.SendAsync(request).Result;
return GetFormattedResponse(responseMessage);
}