I am trying to do a test post to a 3rd party web api. The code how to post was provided by the documentation from 3rd party.
'RestClient' is a namespace but is used like a type
The type or namespace name 'RestRequest' could not be found (are you missing a using directive or an assembly reference?)
The type or namespace name 'IRestResponse' could not be found (are you missing a using directive or an assembly reference?)
The name 'ParameterType' does not exist in the current context
The name 'Method' does not exist in the current context
The method I am working with:
public void CreatePanelists (Newtonsoft.Json.Linq.JObject data)
{
Parameters parameters = JsonConvert.DeserializeObject<Parameters>(data.ToString())
IList<Panelist> panelistList = parameters.panelists;
string id = parameters.id;
var client = new RestClient("https://3rdparty.com/v2/events/5893/atendees");
var request = new RestRequest(Method.POST);
request.AddHeader("content-type", "application/json");
request.AddHeader("authorization", "Bearer vJRMZ92lsOE1sKGVF7_4zCezTjxO2RoFeOVGULSJS2_dRhgU5QfZeKqGaoS0ogPv0WISEuZ1RcNzJDUsv27uGA");
request.AddParameter("application/json", "{\"attendees\":[{\"name\":\"Mary\",\"email\":\"maryjkdfdsgfshdgf@jdfdkjdglfk.jkfgdj\"},{\"name\":\"Mike\",\"email\":\"dfdsgfsdhf@jkgfdgfkdhgfdjg.fkjgdf\"}]}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
}
I installed RestClient 4.0.0 but that did not remove the errors.
I am not using .Net not .net Core. What am I missing?
First time developing this type of project, please pardon if my technical language is not correct.
Your help is much appreciated.
Thank you, Erasmo
UPDATE - I was able to install RestSharp Version 106.11.4.0, and RestClient Version 2.5.0.6.
The only error that persists is
'RestClient' is a namespace but is used like a type