Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/334.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# Rest API-无法更新定义_C#_Rest_Arcgis Online - Fatal编程技术网

C# Rest API-无法更新定义

C# Rest API-无法更新定义,c#,rest,arcgis-online,C#,Rest,Arcgis Online,我不太确定是在这里还是在GIS堆栈中问这个问题。可能两者都有。但是我觉得我在这里做了一些根本错误的事情-更新似乎没有生效(当我在控制台中查看之后,它仍然是错误的) 我正在用C#编写一个过程来更新要素层的定义并使其能够同步。到目前为止,我为其他进程(上传新文件和下载查询)编写的代码都很好,我只是在这方面遇到了一些问题,我想我需要一些指针。官方资源可在以下链接中找到: 我的密码是: static async Task<string> ReSync(string myToken, s

我不太确定是在这里还是在GIS堆栈中问这个问题。可能两者都有。但是我觉得我在这里做了一些根本错误的事情-更新似乎没有生效(当我在控制台中查看之后,它仍然是错误的)

我正在用C#编写一个过程来更新要素层的定义并使其能够同步。到目前为止,我为其他进程(上传新文件和下载查询)编写的代码都很好,我只是在这方面遇到了一些问题,我想我需要一些指针。官方资源可在以下链接中找到:

我的密码是:

static async Task<string> ReSync(string myToken, string ServiceUrl)
{
    try
    {
        var client = new System.Net.Http.HttpClient();
        HttpContent content = new FormUrlEncodedContent(new[]
        {
            new KeyValuePair<string, string>("f", "json"),
            new KeyValuePair<string, string>("token", myToken),
            new KeyValuePair<string, string>("async", "true"),
            new KeyValuePair<string, string>("syncEnabled", "true"),
            new KeyValuePair<string, string>("capabilities", "Query,Editing,Create,Update,Delete,Sync")
        });
        ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;
        var response = await client.PostAsync(ServiceUrl, content);
        var responseString = await response.Content.ReadAsStringAsync();
        return responseString + " <> " + ServiceUrl + " <> " + content;
    }
    catch (Exception exception)
    {
        return exception.ToString();
    }
}
静态异步任务重新同步(字符串myToken,字符串ServiceUrl)
{
尝试
{
var client=new System.Net.Http.HttpClient();
HttpContent=新FormUrlEncodedContent(新[]
{
新的KeyValuePair(“f”、“json”),
新的KeyValuePair(“令牌”,myToken),
新的KeyValuePair(“异步”、“真”),
新的KeyValuePair(“syncEnabled”、“true”),
新的KeyValuePair(“功能”、“查询、编辑、创建、更新、删除、同步”)
});
ServicePointManager.SecurityProtocol=SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;
var response=wait client.PostAsync(ServiceUrl,content);
var responseString=await response.Content.ReadAsStringAsync();
返回responseString+“”+ServiceUrl+“”+内容;
}
捕获(异常)
{
返回异常.ToString();
}
}
我的ServiceUrl大致如下:

返回的responseString(响应、ServiceUrl和内容,按顺序排列)是:

{“statusURL”:“}System.Net.Http.FormUrlEncodedContent

如果我手动操作(从ArcGIS在线控制台)并将响应记录在Chrome的DevTools中,我们会得到(重要信息):

概述

请求URL:

申请方式:邮寄

表单数据

更新定义:{“hasStaticData”:false,“功能”:“查询、编辑、创建、更新、删除、同步”、“编辑跟踪信息”:{“enableEditorTracking”:false,“enableOwnershipAccessControl”:false,“allowOthersToUpdate”:true,“allowOthersToDelete”:true,“allowOthersToQuery”:true,“AllowOnyMousToUpdate”:true,“AllowOnyMousToDelete”:true}

异步:true

f:json

标记:lotsandsofcharactersandstoff


已经有一段时间了,但是为什么不使用Arcgis软件包呢@RobertPouleijn我正在使用SSIS做这件事,我相信它不支持nuget。好建议!构建一个使用该包的控制台应用程序,并使用fiddler找出进行了哪些http调用:P