Shared Contacts API을 사용하면 클라이언트 응용 프로그램에서 Google Apps 도메인의 모든 사용자에게 공유되는 외부 연락처를 검색하고 업데이트 할 수 있습니다. 공유 주소록은 Apps 도메인의 모든 사용자에게 표시되며 모든 Google 서비스는 주소록에 액세스 할 수 있습니다.
게시 할 공유 연락처의 XML 표현을 만듭니다. 따라서, 다음,
이
<atom:entry xmlns:atom='http://www.w3.org/2005/Atom'
xmlns:gd='http://schemas.google.com/g/2005'>
<atom:category scheme='http://schemas.google.com/g/2005#kind'
term='http://schemas.google.com/contact/2008#contact' />
<gd:name>
<gd:givenName>Elizabeth</gd:givenName>
<gd:familyName>Bennet</gd:familyName>
<gd:fullName>Elizabeth Bennet</gd:fullName>
</gd:name>
<atom:content type='text'>Notes</atom:content>
<gd:email rel='http://schemas.google.com/g/2005#work'
primary='true'
address='[email protected]' displayName='E. Bennet' />
<gd:email rel='http://schemas.google.com/g/2005#home'
address='[email protected]' />
<gd:phoneNumber rel='http://schemas.google.com/g/2005#work'
primary='true'>
(206)555-1212
</gd:phoneNumber>
<gd:phoneNumber rel='http://schemas.google.com/g/2005#home'>
(206)555-1213
</gd:phoneNumber>
<gd:im address='[email protected]'
protocol='http://schemas.google.com/g/2005#GOOGLE_TALK'
primary='true'
rel='http://schemas.google.com/g/2005#home' />
<gd:structuredPostalAddress
rel='http://schemas.google.com/g/2005#work'
primary='true'>
<gd:city>Mountain View</gd:city>
<gd:street>1600 Amphitheatre Pkwy</gd:street>
<gd:region>CA</gd:region>
<gd:postcode>94043</gd:postcode>
<gd:country>United States</gd:country>
<gd:formattedAddress>
1600 Amphitheatre Pkwy Mountain View
</gd:formattedAddress>
</gd:structuredPostalAddress>
</atom:entry>
https://www.google.com/m8/feeds/contacts/example.com/full
구글의 서버가 보낸 항목을 사용하여 연락처를 생성하는 HTTP 201 CREATED
상태 코드를 반환 :이 XML은 다음과 같이 나타납니다 연락처 종류의 원자 요소의 형태에 있어야 새 연락처의 복사본은 <entry>
요소의 형태로 제공됩니다.
클라이언트 응용 프로그램은 공유 주소록 API를 사용하여 새 공유 주소록을 만들거나 기존 공유 주소록을 편집 또는 삭제하고 특정 조건에 맞는 공유 주소록을 쿼리 할 수 있습니다.
연락처를 삭제하려면 승인 된 DELETE
요청을 연락처의 편집 URL로 보냅니다.
의 URL의 형식이다 USEREMAIL 및 contactId의 대신 적절한 값
https://www.google.com/m8/feeds/contacts/{userEmail}/full/{contactId}
.
참고 : 특수 userEmail 값 기본값을 사용하여 인증 된 사용자를 참조 할 수 있습니다.
API로 보낸 요청이 다른 클라이언트의 변경 사항을 덮어 쓰지 않도록하려면 연락처 항목의 Etag
을 요청 헤더에 제공해야합니다. Etag
오래된 경우
If-Match: Etag
, 서버는 HTTP 412 Precondition Failed
상태 코드로 응답합니다.
<!-- Request -->
DELETE /m8/feeds/contacts/default/full/contactId
If-match: Etag
...
<!-- Response -->
HTTP/1.1 200 OK
음,이 모든 단계를 알고 정상적으로 아무 문제없이 작동합니다. 이 경우 언급 한 연락처에는 ID가 없습니다! 이 폴더는 Directory 폴더 목록에 표시되지만 일반 연락처 항목처럼 삭제할 수 없습니다. – valley