首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >我正在尝试使用node.I的google reseller api插入新客户。我收到400错误

我正在尝试使用node.I的google reseller api插入新客户。我收到400错误
EN

Stack Overflow用户
提问于 2016-09-02 12:53:06
回答 2查看 138关注 0票数 1

//参数

代码语言:javascript
复制
var params = {
"auth":auth,
"kind": "reseller#customer",
"customerId": "customerId",
"customerDomain": "customer domain",
"postalAddress": {
  "kind": "customers#address",
  "contactName": "John Doe",
  "organizationName": "Example Inc",
  "postalCode": "94043",
  "countryCode": "US",

},
"alternateEmail": "email address  "

}//使用api

代码语言:javascript
复制
var service = google.reseller('v1');
service.customers.insert(params,function(err,data){
   console.log(err);
   console.log(data); 
})

我收到这个错误:

代码语言:javascript
复制
{ [Error: Invalid Value]
  code: 400,
  errors: [ { domain: 'global', reason: 'invalid', message: 'Invalid Value' } ] }
EN

回答 2

Stack Overflow用户

发布于 2016-09-02 13:02:58

您可以使用request模块轻松执行此操作。

下面是一个插入customer并执行它的示例

POST https://www.googleapis.com/apps/reseller/v1/customers

代码语言:javascript
复制
    Body parameter

  {
  "kind": "reseller#customer",
  "customerId": "custId-1234",
  "customerDomain": "example.com",
  "postalAddress": {
    "kind": "customers#address",
    "contactName": "John Doe",
    "organizationName": "Example Inc",
    "postalCode": "94043",
    "countryCode": "US",
  },
  "alternateEmail": "alternateEmail@google.com"
}

了解更多reference

票数 0
EN

Stack Overflow用户

发布于 2016-09-03 16:11:18

您的错误日志中已经说明了该问题。

原因:消息:'Invalid Value‘

Customers resource中不包括"auth":auth

以下是有效值:

代码语言:javascript
复制
{
  "kind": "reseller#customer",
  "customerId": string,
  "customerDomain": string,
  "postalAddress": {
    "kind": "customers#address",
    "contactName": string,
    "organizationName": string,
    "locality": string,
    "region": string,
    "postalCode": string,
    "countryCode": string,
    "addressLine1": string,
    "addressLine2": string,
    "addressLine3": string
  },
  "phoneNumber": string,
  "alternateEmail": string,
  "resourceUiUrl": string,
  "customerDomainVerified": boolean
}
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/39284538

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档