2

我正在使用此代码从 formstack 获取表单的汇总数据

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Net; //webClient
using System.IO; // use for StreamReader

namespace Test_to_integrate_FormStack
{
    class Program
    {
        static void Main(string[] args)
        {

            var uri = string.Format("https://www.formstack.com/api/v2/submission/:313004779.json");
            try
            {
                using (var webClient = new WebClient())
                {
                    webClient.Headers.Add("Accept", "application/json");
                    webClient.Headers.Add("Authorization", "apikey" + "4D6A94162B2");

                    string Response = string.Empty;
                    Response = webClient.DownloadString(uri);
                }
            }
            catch (WebException we)

            {
                using (var sr = new StreamReader(we.Response.GetResponseStream()))
                {
                }
            }
        }
    }
}

它给了我错误:远程服务器返回错误:(400)错误请求。

我应该错在哪里?请务必让我知道。

谢谢你

4

2 回答 2

0

我知道它在游戏后期,但对我来说身份验证看起来不正确。

它应该是“承载 [API KEY]”

于 2017-10-02T20:56:23.953 回答
0

您的网址不正确。

你用过:https ://www.formstack.com/api/v2/submission/:313004779.json

但应该是:https ://www.formstack.com/api/v2/submission/313004779.json

https://developers.formstack.com/reference#submission-id-get

文档显示 /:id ,这意味着它需要一个变量。

https://www.formstack.com/api/v2/submission/id.json

于 2021-05-09T10:23:20.223 回答