通过创建联系人,我总是得到答案
接收到无效的JSON有效负载。未知名称
我的STRJSON是
{
"names": [
{
"familyName": "NN"
}
]
}
Set web_HTTP = CreateObject("WinHttp.WinHttpRequest.5.1")
web_Url_CreateContacts = "https://people.googleapis.com/v1/people:createContact"
web_HTTP.Open "Post", web_Url_CreateContacts & "?" & _
"access_token=" & Token & "&" & _
"key=" & ApiKey & "&" & _
strJson
似乎您将strJson作为查询字符串的一部分,这意味着应该对它进行urlencoded。但我不鼓励这样做。最好使用winHTTP的RequestBody参数进行发布,而不是尝试将其全部放入一个字符串中。和发布。
Set xmlhttp = CreateObject("MSXML2.ServerXMLHTTP")
'list
'~~> Indicates that page that will receive the request and the type of request being
submitted
xmlhttp.Open "POST",
"https://www.example.com/api/go/XSx/rest/inquiry/resolveXInquiry", False
'~~> Indicate that the body of the request contains form data
xmlhttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
''or JSON content type
'~~> Send the data as name/value pairs
'["50061555", "50055854", "500615516", "500615576", "50055910"]
xmlhttp.send "request={""inquiryIds"":[50061333],""requestType"":""Report2"",""from"":""*parameter"",""comment"":""report""}"
非常感谢!
那是我想念的想法!
strJSON必须作为正文发送(XMLHttpRequest.send(正文))。