【问题标题】:Get submitted data from formstack using C#?使用C#从formstack获取提交的数据?
【发布时间】:2017-08-05 20:18:08
【问题描述】:

我正在使用此代码从 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)错误请求。

我应该错在哪里?请务必告诉我。

谢谢

【问题讨论】:

  • 仔细检查您正在使用的文档,以确保您正确地制定了请求。如错误所述,您正在构建和发送的请求无效。您的网址是否正确,标题及其值是否正确,您是否遗漏了什么?
  • 感谢菲尔的回复。我正在核实你所说的。你有这方面的例子吗?

标签: c# .net error-handling integration formstack


【解决方案1】:

我知道它在游戏后期,但我觉得身份验证不正确。

应该是“Bearer [API KEY]”

【讨论】:

    【解决方案2】:
    猜你喜欢
    • 2012-04-11
    • 2016-08-01
    • 2021-02-03
    • 2012-02-10
    • 1970-01-01
    • 2023-03-07
    • 2014-07-11
    • 1970-01-01
    • 2015-12-18
    相关资源
    最近更新 更多