RestSharp POST到Square Connect无法正常工作

时间:2016-01-30 20:53:22

标签: asp.net json api restsharp square-connect

我在下面有以下代码,但它没有完成。我能说的最好的是JSON不正确,但我不是那样的。任何帮助,将不胜感激。当我运行它时,它会告诉我400 Bad Request。

    Dim Client As New RestSharp.RestClient("https://connect.squareup.com")
    Dim Request As New RestSharp.RestRequest("v1/" & MERCHANTID & "/categories", RestSharp.Method.POST)
    Request.RequestFormat = RestSharp.DataFormat.Json
    Request.AddHeader("Authorization", "Bearer " & ACCESS_TOKEN)
    Request.AddHeader("Accept", "application/json")
    Request.AddHeader("Content-Type", "application/json")

    Request.AddParameter("name", "Milkshake")

    Dim response As RestSharp.RestResponse = Client.Execute(Request)
    Dim getresponse As String = response.StatusCode

0 个答案:

没有答案