Square V1 api请求不按API文档工作

时间:2017-07-28 08:05:21

标签: square-connect

我们遇到了几个Square API的错误,它工作了一个星期,现在根据文档没有工作,最近改变的任何与square有关,无法在新闻中找到:https://docs.connect.squareup.com/api/connect/v1/?q=employee#navsection-roles &安培; https://docs.connect.squareup.com/api/connect/v1/?q=employee#navsection-employees

有问题的请求/回复。

例1:有效的role_ids也失败,过去常常工作3-4天。

POST https://connect.squareup.com/v1/me/employees HTTP/1.1
Host: connect.squareup.com
Accept: */*
Authorization: Bearer *****************************
Content-Type: application/json
Content-Length: 120
{
  "first_name": "FIRST_NAME_TEST_SP",
  "last_name": "LAST_NAME_TEST_SP",
  "role_ids": ["T6u3cmJnH7eZbAlvPfql"]
}
--
HTTP/1.1 400 Bad Request
X-Frame-Options: DENY
X-XSS-Protection: 1; mode=block
X-Download-Options: noopen
X-Content-Type-Options: nosniff
X-Request-Id: V6fCtNEkQB2p9lSpswcS
Access-Control-Allow-Origin: *
Access-Control-Expose-Headers: Link
Content-Type: application/json; charset=utf-8
Vary: Accept-Encoding
X-Response-Time: 296ms
Date: Fri, 28 Jul 2017 07:51:07 GMT
Keep-Alive: timeout=60
Strict-Transport-Security: max-age=631152000
content-length: 74
{"type":"bad_request","message":"role_ids [T6u3cmJnH7eZbAlvPfql] invalid"}

例2:根据API文档,role_ids是可选的,但没有它失败。

POST https://connect.squareup.com/v1/me/employees HTTP/1.1
Host: connect.squareup.com
Accept: */*
Authorization: Bearer *****************************
Content-Type: application/json
Content-Length: 87
{
  "first_name": "FIRST_NAME_TEST_MIN_SP",
  "last_name": "LAST_NAME_TEST_MIN_SP"
}
--
HTTP/1.1 400 Bad Request
X-Frame-Options: DENY
X-XSS-Protection: 1; mode=block
X-Download-Options: noopen
X-Content-Type-Options: nosniff
X-Request-Id: fjrobTpoQ/SqjGLjYY+f
Access-Control-Allow-Origin: *
Access-Control-Expose-Headers: Link
Content-Type: application/json; charset=utf-8
Vary: Accept-Encoding
X-Response-Time: 286ms
Date: Fri, 28 Jul 2017 07:51:08 GMT
Keep-Alive: timeout=60
Strict-Transport-Security: max-age=631152000
content-length: 54
{"type":"bad_request","message":"role_ids [] invalid"}

例3:创建角色必须具有权限,但现在已经过了。

POST https://connect.squareup.com/v1/me/roles HTTP/1.1
Host: connect.squareup.com
Accept: */*
Authorization: Bearer *****************************
Content-Type: application/json
Content-Length: 71
{
  "name": "TEST_NAME_EMPTYPERMISSIONMIN_SP",
  "permissions": []
}
--
HTTP/1.1 200 OK
X-Frame-Options: DENY
X-XSS-Protection: 1; mode=block
X-Download-Options: noopen
X-Content-Type-Options: nosniff
X-Request-Id: zPvmsdjdQr+KolWM85K/
Access-Control-Allow-Origin: *
Access-Control-Expose-Headers: Link
Content-Type: application/json; charset=utf-8
Vary: Accept-Encoding
X-Response-Time: 245ms
Date: Fri, 28 Jul 2017 07:51:09 GMT
Keep-Alive: timeout=60
Strict-Transport-Security: max-age=631152000
content-length: 176
{"permissions":[],"id":"pNxPulcufnUpifjqnR0Y","name":"TEST_NAME_EMPTYPERMISSIONMIN_SP","is_owner":false,"updated_at":"2017-07-28T07:51:09Z","created_at":"2017-07-28T07:51:09Z"}

0 个答案:

没有答案