c# - RestSharp version of a cURL PUT request (text/plain) -
a rest api has method upload contents of .csv file (as plain text) using following curl request:
https://api_baseurl/v3/data/contactslist/$listid/csvdata/text:plain \ -h "content-type: text/plain" \ --data-binary "@./test.csv"
where $listid
replaced number @ time of request , test.csv
, assume, replaced content of file. api_baseurl
base url of api privacy reasons have removed here.
i trying convert request restsharp use in program. put
request. using following code make request.
var request = new restrequest(string.format("https://api_baseurl/v3/data/contactslist/{0}/csvdata/text:plain", contactlistid), method.put); request.addparameter("content-type", "text/plain", parametertype.httpheader); request.addbody(filecontent); irestresponse response = _client.execute(request);
when run query, suspect api still thinks running request of xml
content type , therefore receive following response:
data content type "text/xml" not match url content type "text/plain"
what think doing wrong?
Comments
Post a Comment