在RESTSHARP中使用数组[long]正文的http请求

时间:2017-09-25 10:26:18

标签: c# restsharp

Jarray i是从文件中读取的,这是内容: [915417,915418,915419]

这是我的代码:
JArray i = HELPERS_Read_InputJArray_File(input,strEdit);

        IRestResponse resp = null;
        IRestRequest request = null;
        var auth = "Bearer " + api.accessToken;
        ServicePointManager.ServerCertificateValidationCallback += (sender, certificate, chain, sslPolicyErrors) => true;
        var client = new RestClient();
        client.BaseUrl = c.mySiteUri;

        //body setup
        try
        {
            request = new RestRequest(api.HTTPRequestAPI, Method.POST);

            request.AddHeader("Authorization", auth);
            request.RequestFormat = DataFormat.Json;

            request.AddParameter("application/json", i, ParameterType.RequestBody);

            resp = client.Execute(request);
        }
        catch (Exception e)
        {
            Console.Error.WriteLine(e);
        }

问题是编译并返回200,但它没有用。

0 个答案:

没有答案