我正在尝试使用GET hubs API endpoint。我在后端运行Laravel并使用Guzzle发送请求。在获取三足标记和用户个人资料时,此方法效果很好。但是,当我使用Guzzle发送针对用户集线器的GET请求时,它将返回200状态,没有任何内容。
我尝试发送常规的curl,但得到的响应是我没有访问该API的权限。我不确定这是我的最终目的还是在伪造设置中必须解决的问题?
卷曲:
@Document
public class Person {
@Id
private Long personId;
private String name;
private int age;
@DBRef(db = "address")
private List<Address> addresses = new ArrayList<>();
public Person() {
}
@PersistenceConstructor
public Person(Long personId, String name, int age) {
super();
this.personId = personId;
this.name = name;
this.age = age;
}
// setter, getter and toString
}
响应:
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Authorization: Bearer '.$obj->access_token,
'x-user-id:'.$userObj->userId
));
$response = curl_exec ($ch);
$err = curl_error($ch); //if you need
curl_close ($ch);