ביצוע פעולות באצווה
קל לארגן דפים בעזרת אוספים
אפשר לשמור ולסווג תוכן על סמך ההעדפות שלך.
אם מבצעים כמה פעולות, הזמן שנדרש לשליחה ולקבלה של כל הודעות ה-HTTP האלה עלול לגרום לאפליקציה להיות איטית ולא להגיב. באמצעות בקשות באצווה, אפשר לגרום לשרת לבצע כמה פעולות באמצעות בקשת HTTP אחת. הרעיון הבסיסי הוא ליצור פיד של אנשי קשר ולהוסיף רשומה לכל פעולה שרוצים לבצע.
בקשות באצווה מוגבלות ל-100 פעולות בכל פעם. מידע נוסף על פעולות באצווה זמין במאמר עיבוד באצווה ב-Google Data Protocol.
יכול להיות שיחלפו עד 24 שעות לפני שהשינויים יבואו לידי ביטוי בהשלמה האוטומטית של כתובות האימייל ובמנהל אנשי הקשר.
בדוגמת הקוד הבאה מוצגת בקשה באצווה שיוצרת 2 אנשי קשר משותפים. עם זאת, אפשר להשתמש בבקשה באצווה גם כדי לשלוח שאילתות, לעדכן ולמחוק אנשי קשר. כדי שהסנכרון האופטימיסטי יפעל, נדרשים קישורי עריכה של הרשומות לעדכון ולמחיקה.
<?xml version='1.0' encoding='UTF-8'?>
<feed xmlns='http://www.w3.org/2005/Atom'
xmlns:gContact='http://schemas.google.com/contact/2008'
xmlns:gd='http://schemas.google.com/g/2005'
xmlns:batch='http://schemas.google.com/gdata/batch'>
<category scheme='http://schemas.google.com/g/2005#kind'
term='http://schemas.google.com/g/2008#contact' />
<entry>
<batch:id>1</batch:id>
<batch:operation type='insert' />
<category scheme='http://schemas.google.com/g/2005#kind'
term='http://schemas.google.com/g/2008#contact'/>
<gd:name>
<gd:givenName>FIRST_NAME</gd:fullName>
<gd:familyName>LAST_NAME</gd:fullName>
</gd:name>
<gd:email rel='http://schemas.google.com/g/2005#home'
address='EMAIL_ADDRESS' primary='true'/>
</entry>
<entry>
<batch:id>2</batch:id>
<batch:operation type='insert' />
<category scheme='http://schemas.google.com/g/2005#kind'
term='http://schemas.google.com/g/2008#contact'/>
<gd:name>
<gd:givenName>FIRST_NAME</gd:fullName>
<gd:familyName>LAST_NAME</gd:fullName>
</gd:name>
<gd:email rel='http://schemas.google.com/g/2005#home'
address='EMAIL_ADDRESS'
primary='true'/>
</entry>
</feed>
מחליפים את מה שכתוב בשדות הבאים:
FIRST_NAME
: שם הפרטי של איש הקשר ששותף – לדוגמה, אלכס.
LAST_NAME
: שם המשפחה של איש הקשר המשותף, לדוגמה, לוי.
EMAIL_ADDRESS
: כתובת האימייל המועדפת של איש הקשר המשותף, לדוגמה: alk@gmail.com.
אלא אם צוין אחרת, התוכן של דף זה הוא ברישיון Creative Commons Attribution 4.0 ודוגמאות הקוד הן ברישיון Apache 2.0. לפרטים, ניתן לעיין במדיניות האתר Google Developers. Java הוא סימן מסחרי רשום של חברת Oracle ו/או של השותפים העצמאיים שלה.
עדכון אחרון: 2025-03-25 (שעון UTC).
[null,null,["עדכון אחרון: 2025-03-25 (שעון UTC)."],[],[],null,["# Perform batch operations\n\nIf you're performing several operations, the time it takes to send and receive\nall those HTTP messages can make your app slow and unresponsive. With batch\nrequests, you can have the server perform multiple operations with a single HTTP\nrequest. The basic idea is that you create a contacts feed and add an entry for\neach operation that you want to perform.\n\nBatch requests are limited to 100 operations at a time. You can find more\ninformation about batch operations in\n[Batch Processing in the Google Data Protocol](https://developers.google.com/gdata/docs/batch).\nChanges can take up to 24 hours to be reflected in the email address\nautocomplete and the contact manager.\n\nThe following code sample shows a batch request that creates 2 shared\ncontacts; however, you can also use a batch request to query, update, and delete\ncontacts. The update and delete entries require an edit link for\n[optimistic concurrency](https://developers.google.com/gdata/docs/1.0/reference#Optimistic-concurrency)\nto work. \n\n```xml\n\u003c?xml version='1.0' encoding='UTF-8'?\u003e\n\u003cfeed xmlns='http://www.w3.org/2005/Atom'\n xmlns:gContact='http://schemas.google.com/contact/2008'\n xmlns:gd='http://schemas.google.com/g/2005'\n xmlns:batch='http://schemas.google.com/gdata/batch'\u003e\n \u003ccategory scheme='http://schemas.google.com/g/2005#kind'\n term='http://schemas.google.com/g/2008#contact' /\u003e\n \u003centry\u003e\n \u003cbatch:id\u003e1\u003c/batch:id\u003e\n \u003cbatch:operation type='insert' /\u003e\n \u003ccategory scheme='http://schemas.google.com/g/2005#kind'\n term='http://schemas.google.com/g/2008#contact'/\u003e\n \u003cgd:name\u003e\n \u003cgd:givenName\u003eFIRST_NAME\u003c/gd:fullName\u003e\n \u003cgd:familyName\u003eLAST_NAME\u003c/gd:fullName\u003e\n \u003c/gd:name\u003e\n \u003cgd:email rel='http://schemas.google.com/g/2005#home'\n address='EMAIL_ADDRESS' primary='true'/\u003e\n \u003c/entry\u003e\n \u003centry\u003e\n \u003cbatch:id\u003e2\u003c/batch:id\u003e\n \u003cbatch:operation type='insert' /\u003e\n \u003ccategory scheme='http://schemas.google.com/g/2005#kind'\n term='http://schemas.google.com/g/2008#contact'/\u003e\n \u003cgd:name\u003e\n \u003cgd:givenName\u003eFIRST_NAME\u003c/gd:fullName\u003e\n \u003cgd:familyName\u003eLAST_NAME\u003c/gd:fullName\u003e\n \u003c/gd:name\u003e\n \u003cgd:email rel='http://schemas.google.com/g/2005#home'\n address='EMAIL_ADDRESS'\n primary='true'/\u003e\n \u003c/entry\u003e\n\u003c/feed\u003e\n```\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003eFIRST_NAME\u003c/var\u003e: First name of the shared contact---for example, Alex.\n- \u003cvar translate=\"no\"\u003eLAST_NAME\u003c/var\u003e: The last name of the shared contact---for example, Kim.\n- \u003cvar translate=\"no\"\u003eEMAIL_ADDRESS\u003c/var\u003e: The preferred email address of the shared contact---for example, alk@gmail.com."]]