无法将用户连接到 Apigee Usergrid 中的实体
Can't connect user to entity in Apigee Usergrid
使用 IOS API 时,我正在通过 ApigeeDataClient connectEntities 方法进行连接调用。我传入类型 "users",然后是用户的 uuid,然后是连接类型 "likes",连接类型为 "songs" 和歌曲的 uuid。
示例:
ApigeeClientResponse *response = [_dataClient connectEntities:@"users" connectorID:_apigeeUser.uuid connectionType:@"likes" connecteeType:@"songs" connecteeID:song.uuid];
连接的时候提示成功,但是查看服务器上的数据,好像连接保存不正确。例如,对于歌曲,我看到:
connecting :likes :/songs/b523a6aa-bb39-11e4-a2bb-35673af856e9/connecting/likes
这首歌的 uuid 似乎不在连接路径中。
与用户相关的连接也是如此。用户的 uuid 似乎连接到同一用户。 uuid 是歌曲的 uuid,而不是用户的。当我调用 getEntityConnections 时,如下所示:
ApigeeClientResponse *response = [_dataClient getEntityConnections:@"songs" connectorID:_apigeeUser.uuid connectionType:@"likes" query:nil];
它 returns 一个错误,说“预期的歌曲,但得到了用户的 uuid。
实体 c831e1c4-2e6e-11e4-94ce-299efa8c6fd5 不是预期的类型、预期的歌曲、找到的用户
在查看 Apigee 本身的数据部分时,我看到以下代码段:
"connections": {
"likes": "/users/c831e1c4-2e6e-11e4-94ce-299efa8c6fd5/likes"
}
歌曲的 uuid 丢失。即使当我尝试直接在服务器上更新 JSON 时,基本上将歌曲的 uuid 添加到末尾,它说它已保存,但它删除了歌曲的 uuid。
即使只使用 curl 方法建立连接也行不通。例如:
curl -X POST http://api.usergrid.com/peterdj/sandbox/users/bc2fc82a-bfa3-11e4-a994-b19963f1779d/likes/c37f1eaa-bfa3-11e4-9141-97b3510c98e6
当我打电话时,我得到了这个
{"action":"post",
"application":"0baaf590-2c1b-11e4-9bb5-11cb139f1620",
"params":{
},
"path":"/users/bc2fc82a-bfa3-11e4-a994-b19963f1779d/likes",
"uri":"https://api.usergrid.com/peterdj/sandbox/users/bc2fc82a-bfa3-11e4-a994-b19963f1779d/likes",
"entities":[
{
"uuid":"c37f1eaa-bfa3-11e4-9141-97b3510c98e6",
"type":"song",
"name":"WingSpan",
"created":1425167080842,
"modified":1425167080842,
"bpm":"124",
"code":"WingSpan",
"genre":"Progressive House",
"metadata":{
"connecting":{
"likes":"/users/bc2fc82a-bfa3-11e4-a994-b19963f1779d/likes/c37f1eaa-bfa3-11e4-9141-97b3510c98e6/connecting/likes"
},
"path":"/users/bc2fc82a-bfa3-11e4-a994-b19963f1779d/likes/c37f1eaa-bfa3-11e4-9141-97b3510c98e6"
},
"title":"Wing Span"
}
],
"timestamp":1425246006718,
"duration":78,
"organization":"peterdj",
"applicationName":"sandbox"
}
注意,返回的连接路径似乎是正确的,但是当执行另一个 GET curl 时,如下所示:
curl http://api.usergrid.com/peterdj/sandbox/users/bc2fc82a-bfa3-11e4-a994-b19963f1779d
歌曲的 uuid 不存在:
{
"action" : "get",
"application" : "0baaf590-2c1b-11e4-9bb5-11cb139f1620",
"params" : { },
"path" : "/users",
"uri" : "https://api.usergrid.com/peterdj/sandbox/users",
"entities" : [ {
"uuid" : "bc2fc82a-bfa3-11e4-a994-b19963f1779d",
"type" : "user",
"name" : "peter",
"created" : 1425167068578,
"modified" : 1425167495412,
"username" : "peterdj",
"email" : "asdf@adf.com",
"activated" : true,
"picture" :"",
"metadata" : {
"path" : "/users/bc2fc82a-bfa3-11e4-a994-b19963f1779d",
"sets" : {
"rolenames" : "/users/bc2fc82a-bfa3-11e4-a994-b19963f1779d/roles",
"permissions" : "/users/bc2fc82a-bfa3-11e4-a994-b19963f1779d/permissions"
},
"connections" : {
"likes" : "/users/bc2fc82a-bfa3-11e4-a994-b19963f1779d/likes"
},
"collections" : {
"activities" : "/users/bc2fc82a-bfa3-11e4-a994-b19963f1779d/activities",
"devices" : "/users/bc2fc82a-bfa3-11e4-a994-b19963f1779d/devices",
"feed" : "/users/bc2fc82a-bfa3-11e4-a994-b19963f1779d/feed",
"groups" : "/users/bc2fc82a-bfa3-11e4-a994-b19963f1779d/groups",
"roles" : "/users/bc2fc82a-bfa3-11e4-a994-b19963f1779d/roles",
"following" : "/users/bc2fc82a-bfa3-11e4-a994-b19963f1779d/following",
"followers" : "/users/bc2fc82a-bfa3-11e4-a994-b19963f1779d/followers"
}
}
} ],
"timestamp" : 1425311662762,
"duration" : 12,
"organization" : "peterdj",
"applicationName" : "sandbox"
}
这是与 Apigee/Usergrid 的实体连接的错误还是我做错了什么?
谢谢
嗯,事实证明,感谢@remus 的评论,我已经弄明白了。
在这个调用中:
ApigeeClientResponse *response = [_dataClient getEntityConnections:@"songs" connectorID:_apigeeUser.uuid connectionType:@"likes" query:nil];
连接需要 "users",而不是 "songs"。现在工作。谢谢@remus
使用 IOS API 时,我正在通过 ApigeeDataClient connectEntities 方法进行连接调用。我传入类型 "users",然后是用户的 uuid,然后是连接类型 "likes",连接类型为 "songs" 和歌曲的 uuid。
示例:
ApigeeClientResponse *response = [_dataClient connectEntities:@"users" connectorID:_apigeeUser.uuid connectionType:@"likes" connecteeType:@"songs" connecteeID:song.uuid];
连接的时候提示成功,但是查看服务器上的数据,好像连接保存不正确。例如,对于歌曲,我看到:
connecting :likes :/songs/b523a6aa-bb39-11e4-a2bb-35673af856e9/connecting/likes
这首歌的 uuid 似乎不在连接路径中。
与用户相关的连接也是如此。用户的 uuid 似乎连接到同一用户。 uuid 是歌曲的 uuid,而不是用户的。当我调用 getEntityConnections 时,如下所示:
ApigeeClientResponse *response = [_dataClient getEntityConnections:@"songs" connectorID:_apigeeUser.uuid connectionType:@"likes" query:nil];
它 returns 一个错误,说“预期的歌曲,但得到了用户的 uuid。
实体 c831e1c4-2e6e-11e4-94ce-299efa8c6fd5 不是预期的类型、预期的歌曲、找到的用户
在查看 Apigee 本身的数据部分时,我看到以下代码段:
"connections": {
"likes": "/users/c831e1c4-2e6e-11e4-94ce-299efa8c6fd5/likes"
}
歌曲的 uuid 丢失。即使当我尝试直接在服务器上更新 JSON 时,基本上将歌曲的 uuid 添加到末尾,它说它已保存,但它删除了歌曲的 uuid。
即使只使用 curl 方法建立连接也行不通。例如:
curl -X POST http://api.usergrid.com/peterdj/sandbox/users/bc2fc82a-bfa3-11e4-a994-b19963f1779d/likes/c37f1eaa-bfa3-11e4-9141-97b3510c98e6
当我打电话时,我得到了这个
{"action":"post",
"application":"0baaf590-2c1b-11e4-9bb5-11cb139f1620",
"params":{
},
"path":"/users/bc2fc82a-bfa3-11e4-a994-b19963f1779d/likes",
"uri":"https://api.usergrid.com/peterdj/sandbox/users/bc2fc82a-bfa3-11e4-a994-b19963f1779d/likes",
"entities":[
{
"uuid":"c37f1eaa-bfa3-11e4-9141-97b3510c98e6",
"type":"song",
"name":"WingSpan",
"created":1425167080842,
"modified":1425167080842,
"bpm":"124",
"code":"WingSpan",
"genre":"Progressive House",
"metadata":{
"connecting":{
"likes":"/users/bc2fc82a-bfa3-11e4-a994-b19963f1779d/likes/c37f1eaa-bfa3-11e4-9141-97b3510c98e6/connecting/likes"
},
"path":"/users/bc2fc82a-bfa3-11e4-a994-b19963f1779d/likes/c37f1eaa-bfa3-11e4-9141-97b3510c98e6"
},
"title":"Wing Span"
}
],
"timestamp":1425246006718,
"duration":78,
"organization":"peterdj",
"applicationName":"sandbox"
}
注意,返回的连接路径似乎是正确的,但是当执行另一个 GET curl 时,如下所示:
curl http://api.usergrid.com/peterdj/sandbox/users/bc2fc82a-bfa3-11e4-a994-b19963f1779d
歌曲的 uuid 不存在:
{
"action" : "get",
"application" : "0baaf590-2c1b-11e4-9bb5-11cb139f1620",
"params" : { },
"path" : "/users",
"uri" : "https://api.usergrid.com/peterdj/sandbox/users",
"entities" : [ {
"uuid" : "bc2fc82a-bfa3-11e4-a994-b19963f1779d",
"type" : "user",
"name" : "peter",
"created" : 1425167068578,
"modified" : 1425167495412,
"username" : "peterdj",
"email" : "asdf@adf.com",
"activated" : true,
"picture" :"",
"metadata" : {
"path" : "/users/bc2fc82a-bfa3-11e4-a994-b19963f1779d",
"sets" : {
"rolenames" : "/users/bc2fc82a-bfa3-11e4-a994-b19963f1779d/roles",
"permissions" : "/users/bc2fc82a-bfa3-11e4-a994-b19963f1779d/permissions"
},
"connections" : {
"likes" : "/users/bc2fc82a-bfa3-11e4-a994-b19963f1779d/likes"
},
"collections" : {
"activities" : "/users/bc2fc82a-bfa3-11e4-a994-b19963f1779d/activities",
"devices" : "/users/bc2fc82a-bfa3-11e4-a994-b19963f1779d/devices",
"feed" : "/users/bc2fc82a-bfa3-11e4-a994-b19963f1779d/feed",
"groups" : "/users/bc2fc82a-bfa3-11e4-a994-b19963f1779d/groups",
"roles" : "/users/bc2fc82a-bfa3-11e4-a994-b19963f1779d/roles",
"following" : "/users/bc2fc82a-bfa3-11e4-a994-b19963f1779d/following",
"followers" : "/users/bc2fc82a-bfa3-11e4-a994-b19963f1779d/followers"
}
}
} ],
"timestamp" : 1425311662762,
"duration" : 12,
"organization" : "peterdj",
"applicationName" : "sandbox"
}
这是与 Apigee/Usergrid 的实体连接的错误还是我做错了什么?
谢谢
嗯,事实证明,感谢@remus 的评论,我已经弄明白了。
在这个调用中: ApigeeClientResponse *response = [_dataClient getEntityConnections:@"songs" connectorID:_apigeeUser.uuid connectionType:@"likes" query:nil];
连接需要 "users",而不是 "songs"。现在工作。谢谢@remus