Xml model for adding contact to google contacts

人走茶凉 提交于 2019-12-11 04:47:12

问题


I try to write xml model by hand(as described in google-api-java-client site) to add contact to google contacts,but I have always got 400 bad request when trying to POST my contact,I have include all required fields to my model and try different possibilities but it doesn't work.Can anyone write single xml model to add contact with name and phone Number? This is my ContactEntry model:

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;

}

Category class:

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";
}

}

Name class:

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;
}

}

来源:https://stackoverflow.com/questions/8090897/xml-model-for-adding-contact-to-google-contacts

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!