1

我尝试手动编写 xml 模型(如 google-api-java-client 站点中所述)以将联系人添加到 google 联系人,但在尝试发布我的联系人时我总是收到 400 个错误请求,我已包含所有必填字段我的模型并尝试不同的可能性,但它不起作用。任何人都可以编写单个 xml 模型来添加带有姓名和电话号码的联系人吗?这是我的 ContactEntry 模型:

public class ContactEntry
{
@Key
public Category category;

@Key("gd:name")
public Name name;

@Key
public String id;


@Key
public String title;

@Key
public Content content;

@Key("gd:phoneNumber")
public PhoneNumber phoneNumber;

}

分类类:

public class Category
{
@Key("@scheme")
public String scheme;

@Key("@term")
public String term;

public Category()
{
    this.scheme = "http://schemas.google.com/g/2005#kind";
    this.term = "http://schemas.google.com/contact/2008#contact";
}

}

名称类:

public class Name
{
@Key("@gd:givenName")
public String givenName;

@Key("@gd:familyName")
public String familyName;

@Key("@rel")
public String rel;

@Key("@fullName")
public String fullName;

public Name()
{
}

public Name(String givenName,String familyName)
{
    this.givenName = givenName;
    this.familyName = familyName;
    this.rel = "http://schemas.google.com/g/2005#other";//this is for test             
    this.fullName = givenName + familyName;
}

}

4

0 回答 0