ক্লাসিক Google Sites API আপনার অ্যাপ্লিকেশনকে Google সাইটের মধ্যে কন্টেন্ট অ্যাক্সেস, প্রকাশ ও পরিবর্তন করতে দেয়। এছাড়াও, আপনার অ্যাপ্লিকেশন সাম্প্রতিক অ্যাক্টিভিটির তালিকা অনুরোধ করতে, revisionhistory পেতে এবং অ্যাটাচমেন্ট ও ফাইল আপলোড/ডাউনলোড করতে পারে।
দর্শক
এই ডকুমেন্টে ধরে নেওয়া হয়েছে যে আপনি Google Data API প্রোটোকলের পেছনের সাধারণ ধারণাটি বুঝতে পেরেছেন।
এই ডকুমেন্টটি সেইসব প্রোগ্রামারদের জন্য লেখা হয়েছে যারা Google Sites-এর সাথে ইন্টার্যাক্ট করতে পারে এমন ক্লায়েন্ট অ্যাপ্লিকেশন লিখতে চান। এটি ব্যাখ্যা সহ কাঁচা XML/HTTP ব্যবহার করে মৌলিক ডেটা API ইন্টার্যাকশনের উদাহরণগুলির একটি সিরিজ প্রদান করে। এই ডকুমেন্টটি পড়ার পরে, আপনি আমাদের ক্লায়েন্ট লাইব্রেরি ব্যবহার করে API-এর সাথে ইন্টার্যাক্ট করা সম্পর্কে আরও জানতে পারবেন। এর জন্য, বাম-দিকের নেভিগেশন বারে থাকা অন্যান্য নির্দেশিকায় দেওয়া ভাষা-নির্দিষ্ট উদাহরণগুলি পড়ুন।
এই নির্দেশিকায় ব্যবহৃত মেটেরিয়ালের রেফারেন্সের জন্য, রেফারেন্স গাইড দেখুন।
অনুরোধ অনুমোদন করা
আপনার অ্যাপ্লিকেশন যখন সর্বজনীন নয় এমন ব্যবহারকারীর ডেটা অ্যাক্সেস করার অনুরোধ করে, তখন সেটিতে অবশ্যই একটি অনুমোদনের টোকেন থাকতে হবে। এই টোকেনের মাধ্যমে Google আপনার অ্যাপ্লিকেশনকে শনাক্তও করে।
অনুমোদনের প্রোটোকল সম্পর্কে
অনুরোধ অনুমোদনের জন্য আপনার অ্যাপ্লিকেশনকে OAuth 2.0 ব্যবহার করতে হবে। অন্য কোনও অনুমোদনের প্রোটোকল ব্যবহার করা যাবে না। আপনার অ্যাপ্লিকেশন Google-এর মাধ্যমে সাইন-ইন করুন ব্যবহার করলে, অনুমোদনের কিছু দিক আপনার হয়ে ম্যানেজ করা হয়।
OAuth 2.0 ব্যবহার করে অনুরোধ অনুমোদন করা হচ্ছে
সর্বজনীন নয় এমন ব্যবহারকারীর ডেটার জন্য Google Sites Data API-তে করা অনুরোধ কোনও যাচাই করা ব্যবহারকারীকে অনুমোদন করতে হবে।
আপনি কী ধরনের অ্যাপ্লিকেশন তৈরি করছেন তার উপর নির্ভর করে OAuth 2.0-এর জন্য অনুমোদনের প্রসেস বা "flow"-এর পরিবর্তন হতে পারে। নিম্নলিখিত সাধারণ প্রসেস সব ধরনের অ্যাপ্লিকেশনের ক্ষেত্রে প্রযোজ্য হয়:
- আপনি আপনার অ্যাপ্লিকেশন তৈরি করার সময় Google এপিআই কনসোল ব্যবহার করে সেটি রেজিস্টার করেন। তারপরে, আপনার প্রয়োজন হতে পারে এমন তথ্য Google প্রদান করে, যেমন একটি ক্লায়েন্ট আইডি এবং ক্লায়েন্ট সিক্রেট।
- Google API Console-এ Google Sites Data API অ্যাক্টিভেট করুন। (এপিআই কনসোল-এ এপিআই সূচিবদ্ধ না করা থাকলে, এই ধাপ গ্রহণ করবেন না।)
- ব্যবহারকারীর ডেটা আপনার অ্যাপ্লিকেশনের অ্যাক্সেস করার প্রয়োজন হলে, সেটি Google-এর কাছে অ্যাক্সেসের বিশেষ স্কোপ চায়।
- আপনার অ্যাপ্লিকেশনের সাথে ব্যবহারকারীর কিছু ডেটা শেয়ার করার অনুমতি চেয়ে Google তাকে একটি সম্মতির স্ক্রিন দেখায়।
- ব্যবহারকারী অনুমতি দিলে, Google আপনার অ্যাপ্লিকেশনকে একটি ক্ষণস্থায়ী অ্যাক্সেস টোকেন দেয়।
- আপনার অ্যাপ্লিকেশন ব্যবহারকারীর থেকে ডেটা অনুরোধ করার সময়, সেটির সাথে অ্যাক্সেস টোকেনটি যোগ করে দেয়।
- আপনার অনুরোধ ও টোকেন Google সঠিক বলে নির্ধারণ করলে, সেটি অনুরোধ করা ডেটা পাঠায়।
কোনও কোনও 'flow'-এর ক্ষেত্রে কিছু অতিরিক্ত ধাপ থাকে, যেমন নতুন অ্যাক্সেস টোকেন পাওয়ার জন্য রিফ্রেশ টোকেন ব্যবহার করা। বিভিন্ন ধরনের অ্যাপ্লিকেশনের ফ্লো সম্পর্কে আরও জানতে, Google-এর OAuth 2.0 ডকুমেন্টেশন দেখুন।
Google Sites Data API-এর জন্য OAuth 2.0 স্কোপ সংক্রান্ত তথ্য এখানে দেওয়া হল:
https://sites.google.com/feeds/
OAuth 2.0 ব্যবহার করে অ্যাক্সেস করার অনুরোধ করতে, আপনার অ্যাপ্লিকেশনের স্কোপের তথ্য সহ অ্যাপ্লিকেশন রেজিস্টার করার সময় Google যে তথ্য (যেমন ক্লায়েন্ট আইডি ও ক্লায়েন্ট সিক্রেট) আপনার সাথে শেয়ার করে সেগুলিও প্রয়োজন।
ভার্সন নির্দিষ্ট করা
Google Sites Data API-তে আপনার করা প্রতিটি অনুরোধে 1.4 ভার্সন উল্লেখ করতে হবে। কোনও ভার্সন নম্বর নির্দিষ্ট করতে,
GData-Version HTTP হেডার ব্যবহার করুন:
GData-Version: 1.4
অথবা, আপনি HTTP হেডার সেট করতে না পারলে, URL-এ কোয়েরি প্যারামিটার হিসেবে v=1.4 নির্দিষ্ট করতে পারবেন। তবে, যেখানে সম্ভব সেখানে
HTTP হেডার ব্যবহার করা ভালো।
মনে রাখবেন: ক্লায়েন্ট লাইব্রেরি উপযুক্ত ভার্সন হেডার অটোমেটিক সাপ্লাই করে, তাই আপনি ক্লায়েন্ট লাইব্রেরি ব্যবহার করার সময়
v=1.4 কোয়েরি প্যারামিটার ব্যবহার করবেন না।
সাইট ফিড
সাইট ফিড ব্যবহার করে কোনও ব্যবহারকারীর মালিকানাধীন বা দেখার অনুমতি আছে এমন Google Sites-এর তালিকা তৈরি করা যায় এবং আগে থেকে থাকা সাইটের নামও পরিবর্তন করা যায়। এছাড়াও, G Suite ডোমেনের ক্ষেত্রে, এটি সম্পূর্ণ সাইট তৈরি বা কপি করতে ব্যবহার করা যেতে পারে।
তালিকাভুক্ত করার সাইট
ব্যবহারকারীর অ্যাক্সেস আছে এমন সাইটের তালিকা পেতে, নিম্নলিখিত URL-এ একটি যাচাই করা GET অনুরোধ পাঠান:
https://sites.google.com/feeds/site/domainName| ফিড প্যারামিটার | বিবরণ |
|---|---|
domainName | 'site' অথবা আপনার G Suite হোস্ট করা ডোমেনের ডোমেন (যেমন, example.com)। |
উত্তরে সাইটের তালিকা সহ একটি ফিড থাকবে:
GET /feeds/site/domainName HTTP/1.1 Host: sites.google.com GData-Version: 1.4 Authorization: <your authorization header here> HTTP/1.1 200 OK <feed xmlns="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:gAcl="http://schemas.google.com/acl/2007" xmlns:sites="http://schemas.google.com/sites/2008" xmlns:gs="http://schemas.google.com/spreadsheets/2006" xmlns:dc="http://purl.org/dc/terms" xmlns:batch="http://schemas.google.com/gdata/batch" xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0"> <id>https://sites.google.com/feeds/site/site</id> <updated>2009-12-02T17:47:34.406Z</updated> <title>Site</title> <link rel="http://schemas.google.com/g/2005#feed" type="application/atom+xml" href="https://sites.google.com/feeds/site/site"/> <link rel="http://schemas.google.com/g/2005#post" type="application/atom+xml" href="https://sites.google.com/feeds/feeds/site/domainName"/> <link rel="self" type="application/atom+xml" href="https://sites.google.com/feeds/site/domainName"/> <link rel="next" type="application/atom+xml" href="https://sites.google.com/feeds/site/domainName/?start-index=2"/> <generator version="1" uri="http://sites.google.com/">Google Sites</generator> <openSearch:startIndex>1</openSearch:startIndex> <entry gd:etag="W/"CkUAQH4_eil7I2A9WxNaFk4.""> <id>https://sites.google.com/feeds/site/site/myTestSite</id> <updated>2009-12-01T01:17:21.042Z</updated> <app:edited xmlns:app="http://www.w3.org/2007/app">2009-12-01T01:17:21.042Z</app:edited> <title>myTestSite</title> <summary/> <link rel="alternate" type="text/html" href="http://sites.google.com/site/myTestSite/"/> <link rel="http://schemas.google.com/acl/2007#accessControlList" type="application/atom+xml" href="https://sites.google.com/feeds/acl/site/domainName/myTestSite"/> <link rel="self" type="application/atom+xml" href="https://sites.google.com/feeds/site/domainName/myTestSite"/> <link rel="edit" type="application/atom+xml" href="https://sites.google.com/feeds/site/domainName/myTestSite"/> <sites:siteName>myTestSite</sites:siteName> <sites:theme>default</sites:theme> </entry> <entry gd:etag="W/"DkQGQHczfA9WxNaFk4.""> <id>https://sites.google.com/feeds/site/domainName/myOtherTestSite</id> <updated>2009-12-01T02:25:21.987Z</updated> <app:edited xmlns:app="http://www.w3.org/2007/app">2009-12-01T02:25:21.987Z</app:edited> <title>myOtherTestSite</title> <summary>A new site to hold memories</summary> <category scheme="http://schemas.google.com/sites/2008#tag" term="Memories Site"/> <link rel="alternate" type="text/html" href="http://sites.google.com/site/myOtherTestSite"/> <link rel="http://schemas.google.com/acl/2007#accessControlList" type="application/atom+xml" href="https://sites.google.com/feeds/acl/site/domainName/myOtherTestSite"/> <link rel="self" type="application/atom+xml" href="https://sites.google.com/feeds/site/domainName/myOtherTestSite"/> <link rel="edit" type="application/atom+xml" href="https://sites.google.com/feeds/site/domainName/myOtherTestSite"/> <sites:siteName>myOtherTestSite</sites:siteName> <sites:theme>iceberg</sites:theme> </entry> ... </feed>
সাইটগুলি বর্ণানুক্রমিকভাবে তালিকাভুক্ত করা হয়েছে।
নতুন সাইট তৈরি করা
মনে রাখবেন: এই ফিচার শুধুমাত্র G Suite ডোমেনে উপলভ্য।
সাইট ফিডে HTTP POST করে নতুন সাইট প্রোভিশন করা যেতে পারে, যেমন:
POST /feeds/site/example.com HTTP/1.1 Host: sites.google.com GData-Version: 1.4 Authorization: <your authorization header here> <entry xmlns="http://www.w3.org/2005/Atom" xmlns:sites="http://schemas.google.com/sites/2008"> <title>Source Site</title> <summary>A new site to hold memories</summary> <sites:theme>slate</sites:theme> </entry>
উপরের অনুরোধটি G Suite ডোমেন example.com-এর অধীনে 'স্লেট' থিম সহ একটি নতুন Google সাইট তৈরি করবে।
সাইটের URL হবে http://sites.google.com/a/example.com/source-site/.
সাইট তৈরি করা হয়ে গেলে, সার্ভার 201 Created দিয়ে উত্তর দেবে।
উত্তর এন্ট্রিতে সার্ভারের যোগ করা এলিমেন্ট থাকবে, যেমন সাইটের
লিঙ্ক, সাইটের ACL ফিডের লিঙ্ক, সাইটের নাম, শীর্ষক ও সারসংক্ষেপ।
<entry xmlns="http://www.w3.org/2005/Atom" xmlns:gAcl="http://schemas.google.com/acl/2007"
xmlns:sites="http://schemas.google.com/sites/2008" xmlns:gs="http://schemas.google.com/spreadsheets/2006"
xmlns:dc="http://purl.org/dc/terms" xmlns:batch="http://schemas.google.com/gdata/batch"
xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0"
gd:etag="W/"DEECR38l7I2A9WxNaF0Q."">
<id>https://sites.google.com/feeds/site/example.com/source-site</id>
<updated>2009-12-02T23:31:06.184Z</updated>
<app:edited xmlns:app="http://www.w3.org/2007/app">2009-12-02T23:31:06.184Z</app:edited>
<title>New Test Site</title>
<summary>A new site to hold memories</summary>
<link rel="alternate" type="text/html" href="http://sites.google.com/a/example.com/source-site/"/>
<link rel="http://schemas.google.com/acl/2007#accessControlList" type="application/atom+xml"
href="https://sites.google.com/feeds/acl/site/example.com/source-site"/>
<link rel="self" type="application/atom+xml" href="https://sites.google.com/feeds/site/example.com/source-site"/>
<link rel="edit" type="application/atom+xml" href="https://sites.google.com/feeds/site/example.com/source-site"/>
<sites:siteName>source-site</sites:siteName>
<sites:theme>slate</sites:theme>
</entry>
সাইট কপি করা
মনে রাখবেন: এই ফিচার শুধুমাত্র G Suite ডোমেনে উপলভ্য।
নতুন সাইট তৈরি করার মতোই কোনও আগে থেকে থাকা সাইট ডুপ্লিকেট করা যেতে পারে। তবে, POST অনুরোধের Atom এন্ট্রিতে,
কপি করার জন্য সাইটের সাইট ফিডের দিকে rel='source' নির্দেশ করে এমন <link> অন্তর্ভুক্ত করুন। কপি করা
যেকোনও সাইটে এই লিঙ্ক থাকবে। সাইট ডুপ্লিকেট করার একটি উদাহরণ এখানে দেওয়া হল:
POST /feeds/site/example.com HTTP/1.1 Host: sites.google.com GData-Version: 1.4 Authorization: <your authorization header here> <entry xmlns="http://www.w3.org/2005/Atom"> <link rel="http://schemas.google.com/sites/2008#source" type="application/atom+xml" href="https://sites.google.com/feeds/site/example.com/source-site"/> <title>Copy of New Test Site</title> <summary>A newer site to hold memories</summary> </entry>
উপরের অনুরোধটি http://sites.google.com/a/example.com/source-site/ লিঙ্কে থাকা সাইটটি কপি করবে।
গুরুত্বপূর্ণ বিষয়:
- যাচাই করা ব্যবহারকারী মালিকানাধীন শুধুমাত্র সেইসব সাইট ও সাইট টেমপ্লেট কপি করা যাবে।
- এছাড়াও, সাইট টেমপ্লেট কপি করা যেতে পারে। Google Sites সেটিংস পৃষ্ঠায় "এই সাইটকে টেমপ্লেট হিসেবে প্রকাশ করুন" সেটিংয়ে টিকচিহ্ন দেওয়া থাকলে, সাইটটি একটি টেমপ্লেট।
- আপনি অন্য ডোমেন থেকে কোনও সাইট কপি করতে পারবেন, তবে আপনাকে সোর্স সাইটে মালিক হিসেবে তালিকাভুক্ত থাকতে হবে।
সাইটের মেটাডেটা আপডেট করা
কোনও সাইটের শীর্ষক বা সারসংক্ষেপ আপডেট করতে, সাইট এন্ট্রির edit লিঙ্কে HTTP PUT পাঠান।
যেমন, নিম্নলিখিত উদাহরণটি আগের সাইটের নাম New Test Site2 এবং এর
বিবরণ Newer description হিসেবে আপডেট করবে।
PUT /feeds/site/example.com/source-site HTTP/1.1 Host: sites.google.com GData-Version: 1.4 Authorization: <your authorization header here> <entry xmlns="http://www.w3.org/2005/Atom" xmlns:gAcl="http://schemas.google.com/acl/2007" xmlns:sites="http://schemas.google.com/sites/2008" xmlns:gs="http://schemas.google.com/spreadsheets/2006" xmlns:dc="http://purl.org/dc/terms" xmlns:batch="http://schemas.google.com/gdata/batch" xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0" gd:etag="W/"DEECR38l7I2A9WxNaF0Q.""> <id>https://sites.google.com/feeds/site/example.com/source-site</id> <updated>2009-12-02T23:31:06.184Z</updated> <app:edited xmlns:app="http://www.w3.org/2007/app">2009-12-02T23:31:06.184Z</app:edited> <title>New Test Site2</title> <summary>Newer description</summary> <category scheme="http://schemas.google.com/sites/2008#tag" term="Category"/> <link rel="alternate" type="text/html" href="http://sites.google.com/a/example.com/source-site/"/> <link rel="http://schemas.google.com/acl/2007#accessControlList" type="application/atom+xml" href="https://sites.google.com/feeds/acl/site/example.com/source-site"/> <link rel="self" type="application/atom+xml" href="https://sites.google.com/feeds/site/example.com/source-site"/> <link rel="edit" type="application/atom+xml" href="https://sites.google.com/feeds/site/example.com/source-site"/> <sites:siteName>source-site</sites:siteName> </entry>
বিভাগ যোগ করা
মনে রাখবেন: এই ফিচার শুধুমাত্র G Suite ডোমেনে উপলভ্য।
আপনার ডোমেনের জন্য G Suite সাইটে বিভাগ মেটা ডেটা থাকে যা আপনার ডোমেনের মধ্যে সাইটকে শ্রেণীবদ্ধ করার জন্য উপযোগী। ক্যাটাগরি মেটা ডেটা যোগ বা আপডেট করতে, আপনার সাইট এন্ট্রির edit লিঙ্কে একটি category ট্যাগ সহ HTTP PUT পাঠান। নিচের উদাহরণে বোল্ড করা লাইনটি দেখুন:
PUT /feeds/site/example.com/source-site HTTP/1.1 Host: sites.google.com GData-Version: 1.4 Authorization: <your authorization header here> <entry xmlns="http://www.w3.org/2005/Atom" xmlns:gAcl="http://schemas.google.com/acl/2007" xmlns:sites="http://schemas.google.com/sites/2008" xmlns:gs="http://schemas.google.com/spreadsheets/2006" xmlns:dc="http://purl.org/dc/terms" xmlns:batch="http://schemas.google.com/gdata/batch" xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0" gd:etag="W/"DEECR38l7I2A9WxNaF0Q.""> <id>https://sites.google.com/feeds/site/example.com/source-site</id> <updated>2009-12-02T23:31:06.184Z</updated> <app:edited xmlns:app="http://www.w3.org/2007/app">2009-12-02T23:31:06.184Z</app:edited> <title>My Team website</title> <summary>This site contains contact information and a summary of major efforts our team owns</summary> <category scheme="http://schemas.google.com/sites/2008#tag" term="Team Site"/> <link rel="alternate" type="text/html" href="http://sites.google.com/a/example.com/my-team-site/"/> <link rel="http://schemas.google.com/acl/2007#accessControlList" type="application/atom+xml" href="https://sites.google.com/feeds/acl/site/example.com/my-team-site"/> <link rel="self" type="application/atom+xml" href="https://sites.google.com/feeds/site/example.com/my-team-site"/> <link rel="edit" type="application/atom+xml" href="https://sites.google.com/feeds/site/example.com/my-team-site"/> <sites:siteName>my-team-site</sites:siteName> </entry>
এই উদাহরণে আগে থেকে থাকা একটি সাইট এডিট করা হয়েছে এবং "টিম সাইট" বিভাগ যোগ করা হয়েছে।
এছাড়াও, আপনি অতিরিক্ত <category> ট্যাগ যোগ করে একাধিক বিভাগ যোগ করতে পারবেন। নিচের উদাহরণে গাঢ় লাইনগুলি দেখুন:
PUT /feeds/site/example.com/my-team-site HTTP/1.1 Host: sites.google.com GData-Version: 1.4 Authorization: <your authorization header here> <entry xmlns="http://www.w3.org/2005/Atom" xmlns:gAcl="http://schemas.google.com/acl/2007" xmlns:sites="http://schemas.google.com/sites/2008" xmlns:gs="http://schemas.google.com/spreadsheets/2006" xmlns:dc="http://purl.org/dc/terms" xmlns:batch="http://schemas.google.com/gdata/batch" xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0" gd:etag="W/"DEECR38l7I2A9WxNaF0Q.""> <id>https://sites.google.com/feeds/site/example.com/my-team-site</id> <updated>2009-12-02T23:31:06.184Z</updated> <app:edited xmlns:app="http://www.w3.org/2007/app">2009-12-02T23:31:06.184Z</app:edited> <title>My Team website</title> <summary>This site contains contact information and a summary of major efforts our team owns</summary> <category scheme="http://schemas.google.com/sites/2008#tag" term="Team Site/"> <category scheme="http://schemas.google.com/sites/2008#tag" term="Legal Department/"> <link rel="alternate" type="text/html" href="http://sites.google.com/a/example.com/my-team-site/"/> <link rel="http://schemas.google.com/acl/2007#accessControlList" type="application/atom+xml" href="https://sites.google.com/feeds/acl/site/example.com/my-team-site"/> <link rel="self" type="application/atom+xml" href="https://sites.google.com/feeds/site/example.com/my-team-site"/> <link rel="edit" type="application/atom+xml" href="https://sites.google.com/feeds/site/example.com/my-team-site"/> <sites:siteName>my-team-site</sites:siteName> </entry>
এই উদাহরণে দুটি বিভাগ যোগ করা হয়েছে: "টিম সাইট" ও "আইনি বিভাগ"
ওয়েব অ্যাড্রেস ম্যাপিং
ওয়েব অ্যাড্রেস ম্যাপিংয়ের মাধ্যমে Sites ব্যবহারকারীরা তাদের নিজস্ব ডোমেনকে Google সাইটের সাথে ম্যাপ করতে পারেন। যেমন, http://sites.google.com/a/domain.com/mysite-এর পরিবর্তে http://www.mydomainsite.com
ব্যবহার করা যেতে পারে। আপনার সাইট কোথায় হোস্ট করা হয়েছে তার উপর নির্ভর করে, আপনি কোনও
সাইটের ওয়েব অ্যাড্রেস ম্যাপিং ম্যানুয়ালি পরিবর্তন করতে পারবেন। আরও তথ্যের জন্য আমাদের সহায়তা কেন্দ্র নিবন্ধ দেখুন।
কোনও সাইটের ওয়েব অ্যাড্রেস ম্যাপিং ফেচ করা
কোনও সাইটের জন্য ওয়েব অ্যাড্রেস ম্যাপিং ফিরিয়ে আনতে, with-mappings=true প্যারামিটার সহ সাইট এন্ট্রি/ফিড ফেচ করুন:
GET /feeds/site/domainName?with-mappings=true HTTP/1.1 Host: sites.google.com GData-Version: 1.4 Authorization: <your authorization header here> HTTP/1.1 200 OK <feed xmlns="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:gAcl="http://schemas.google.com/acl/2007" xmlns:sites="http://schemas.google.com/sites/2008" xmlns:gs="http://schemas.google.com/spreadsheets/2006" xmlns:dc="http://purl.org/dc/terms" xmlns:batch="http://schemas.google.com/gdata/batch" xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0"> ... <entry gd:etag="W/"DkQGQHczfA9WxNaFk4.""> <id>https://sites.google.com/feeds/site/domainName/myOtherTestSite</id> <updated>2009-12-01T02:25:21.987Z</updated> <app:edited xmlns:app="http://www.w3.org/2007/app">2009-12-01T02:25:21.987Z</app:edited> <title>myOtherTestSite</title> <summary>A new site to hold memories</summary> <link rel="alternate" type="text/html" href="http://sites.google.com/site/myOtherTestSite"/> <link rel="http://schemas.google.com/acl/2007#accessControlList" type="application/atom+xml" href="https://sites.google.com/feeds/acl/site/domainName/myOtherTestSite"/> <link rel="self" type="application/atom+xml" href="https://sites.google.com/feeds/site/domainName/myOtherTestSite"/> <link rel="edit" type="application/atom+xml" href="https://sites.google.com/feeds/site/domainName/myOtherTestSite"/> <link rel='webAddressMapping' href='http://www.mysitemapping.com'> <link rel='webAddressMapping' href='http://www.mysitemapping2.com'> <link rel='webAddressMapping' href='http://www.myothermapping.org'> </entry> ... </feed>
আগে থেকে থাকা ম্যাপিং links হিসেবে rel='webAddressMapping' সহ দেখানো হবে। যেমন, উপরের উদাহরণে
সাইটের দিকে নির্দেশ করে এমন তিনটি webAddressMappings আছে
http://sites.google.com/site/myOtherTestSite।
ওয়েব অ্যাড্রেস ম্যাপিং পরিবর্তন করা
মনে রাখবেন: ওয়েব অ্যাড্রেস ম্যাপিংয়ের সাথে কাজ করার সময় সব GET/POST/PUT অপারেশনকে with-mappings=true প্যারামিটার নির্দিষ্ট করতে হবে।
প্যারামিটার না থাকলে, সাইট এন্ট্রি (GET) থেকে webAddressMappings রিটার্ন করা হবে না অথবা কোনও এন্ট্রি থেকে ম্যাপিং আপডেট/সরানোর (PUT) সময়
বিবেচনা করা হবে না।
ম্যাপিং যোগ করতে, আপডেট করতে বা মুছে দিতে, নতুন সাইট তৈরি করার সময় বা
সাইটের মেটাডেটা আপডেট করার সময় এই ধরনের লিঙ্ক নির্দিষ্ট করুন, পরিবর্তন করুন বা সরিয়ে দিন। সাইট ফিড URI-তে with-mappings=true প্যারামিটার অবশ্যই অন্তর্ভুক্ত করতে হবে।
মনে রাখবেন: অ্যাড্রেস ম্যাপিং আপডেট করতে, আপনাকে সাইট অ্যাডমিন হতে হবে অথবা G Suite-এর মাধ্যমে হোস্ট করা সাইটের ক্ষেত্রে ডোমেন অ্যাডমিন হতে হবে।
যেমন, নিচের অনুরোধটি http://www.mysitemapping.com ম্যাপিংকে http://www.my-new-sitemapping.com-এ আপডেট করে,
এবং এন্ট্রি থেকে লিঙ্কটি বাদ দিয়ে http://www.mysitemapping2.com সরিয়ে দেয়:
PUT /feeds/site/domainName?with-mappings=true HTTP/1.1 Host: sites.google.com GData-Version: 1.4 Authorization: <your authorization header here> <entry gd:etag="W/"DkQGQHczfA9WxNaFk4.""> <id>https://sites.google.com/feeds/site/domainName/myOtherTestSite</id> <updated>2009-12-01T02:25:21.987Z</updated> <app:edited xmlns:app="http://www.w3.org/2007/app">2009-12-01T02:25:21.987Z</app:edited> <title>myOtherTestSite</title> <summary>A new site to hold memories</summary> <link rel="alternate" type="text/html" href="http://sites.google.com/site/myOtherTestSite"/> <link rel="http://schemas.google.com/acl/2007#accessControlList" type="application/atom+xml" href="https://sites.google.com/feeds/acl/site/domainName/myOtherTestSite"/> <link rel="self" type="application/atom+xml" href="https://sites.google.com/feeds/site/domainName/myOtherTestSite"/> <link rel="edit" type="application/atom+xml" href="https://sites.google.com/feeds/site/domainName/myOtherTestSite"/> <link rel='webAddressMapping' href='www.my-new-sitemapping.com'> <!-- missing mapping2 will be deleted --> <link rel='webAddressMapping' href='http://www.myothermapping.org'> </entry>
মনে রাখবেন, সাইট তৈরি/কপি করার সময়ও ওয়েব অ্যাড্রেস ম্যাপিং নির্দিষ্ট করা যেতে পারে।
অ্যাক্টিভিটি ফিড
অ্যাক্টিভিটি ফিড ফেচ করে আপনি কোনও সাইটের সাম্প্রতিক অ্যাক্টিভিটি (পরিবর্তন) ফেচ করতে পারবেন। অ্যাক্টিভিটি ফিডের প্রতিটি এন্ট্রি সাইটে করা পরিবর্তন সংক্রান্ত তথ্য দেখায়।
অ্যাক্টিভিটি ফিড কোয়েরি করতে, অ্যাক্টিভিটি ফিড URL-এ একটি HTTP GET পাঠান:
https://sites.google.com/feeds/activity/domainName/siteName
| ফিড প্যারামিটার | বিবরণ |
|---|---|
domainName | 'site' অথবা আপনার G Suite হোস্ট করা ডোমেনের ডোমেন (যেমন, example.com)। |
siteName | আপনার সাইটের ওয়েবস্পেসের নাম; এটি সাইটের URL-এ পাওয়া যায় (যেমন, myCoolSite)। |
অনুরোধ ও উত্তরের উদাহরণ:
GET /feeds/activity/site/siteName HTTP/1.1 Host: sites.google.com GData-Version: 1.4 Authorization: <your authorization header here> HTTP/1.1 200 OK <?xml version="1.0" encoding="UTF-8"?> <feed xmlns="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/"> <id>https://sites.google.com/feeds/activity/site/siteName</id> <updated>2009-09-10T05:24:23.120Z</updated> <title>Activity</title> <link rel="alternate" type="text/html" href="http://sites.google.com/site/siteName/system/app/pages/recentChanges"/> <link rel="http://schemas.google.com/g/2005#feed" type="application/atom+xml" href="https://sites.google.com/feeds/activity/site/siteName"/> <link rel="self" type="application/atom+xml" href="https://sites.google.com/feeds/activity/site/siteName"/> <generator version="1" uri="http://sites.google.com">Google Sites</generator> <openSearch:startIndex>1</openSearch:startIndex> <entry xmlns:gd="http://schemas.google.com/g/2005" gd:etag="W/"CU4GQ3szfSl7ImA9WxNRFUg.""> <id>https://sites.google.com/feeds/activity/site/siteName/940375996952876062</id> <updated>2009-09-10T03:38:42.585Z</updated> <category scheme="http://schemas.google.com/g/2005#kind" term="http://schemas.google.com/sites/2008#deletion" label="deletion"/> <title>home</title> <summary type="xhtml"> <div xmlns="http://www.w3.org/1999/xhtml">User deleted <a href="http://sites.google.com/site/siteName/home">home</a> </div> </summary> <link rel="http://schemas.google.com/sites/2008#revision" type="application/atom+xml" href="https://sites.google.com/feeds/revision/site/siteName/5409745539831916487"/> <link rel="http://schemas.google.com/sites/2008#current" type="application/atom+xml" href="https://sites.google.com/feeds/content/site/siteName/5409745539831916487"/> <link rel="self" type="application/atom+xml" href="https://sites.google.com/feeds/activity/site/siteName/940375996952876062"/> <author> <name>User</name> <email>user@gmail.com</email> </author> </entry> <entry xmlns:gd="http://schemas.google.com/g/2005" gd:etag="W/"CU8DQn45fyl7ImA9WxNRFUg.""> <id>https://sites.google.com/feeds/activity/site/siteName/7165439066235480082</id> <updated>2009-09-10T03:37:53.027Z</updated> <category scheme="http://schemas.google.com/g/2005#kind" term="http://schemas.google.com/sites/2008#edit" label="edit"/> <title>home</title> <summary type="xhtml"> <div xmlns="http://www.w3.org/1999/xhtml">User2 edited <a href="http://sites.google.com/site/siteName/home">home</a> </div> </summary> <link rel="http://schemas.google.com/sites/2008#revision" type="application/atom+xml" href="https://sites.google.com/feeds/revision/site/siteName/5409745539831916487"/> <link rel="http://schemas.google.com/sites/2008#current" type="application/atom+xml" href="https://sites.google.com/feeds/content/site/siteName/5409745539831916487"/> <link rel="self" type="application/atom+xml" href="https://sites.google.com/feeds/activity/site/siteName/7165439066235480082"/> <author> <name>User</name> <email>user@gmail.com</email> </author> </entry> <entry xmlns:gd="http://schemas.google.com/g/2005" gd:etag="W/"CU8AR3s4cSl7ImA9WxNRFUg.""> <id>https://sites.google.com/feeds/activity/site/siteName/127448462987345884</id> <updated>2009-09-10T03:37:26.539Z</updated> <category scheme="http://schemas.google.com/g/2005#kind" term="http://schemas.google.com/sites/2008#creation" label="creation"/> <title>home</title> <summary type="xhtml"> <div xmlns="http://www.w3.org/1999/xhtml">User3 created <a href="http://sites.google.com/site/siteName/home">home</a> </div> </summary> <link rel="http://schemas.google.com/sites/2008#revision" type="application/atom+xml" href="https://sites.google.com/feeds/revision/site/siteName/5409745539831916487"/> <link rel="http://schemas.google.com/sites/2008#current" type="application/atom+xml" href="https://sites.google.com/feeds/content/site/siteName/5409745539831916487"/> <link rel="self" type="application/atom+xml" href="https://sites.google.com/feeds/activity/site/siteName/127448462987345884"/> <author> <name>User3</name> <email>user3@gmail.com</email> </author> </entry> </feed>
মনে রাখবেন: এই ফিড অ্যাক্সেস করতে হলে আপনাকে সাইটের মালিক বা কোল্যাবরেটর হতে হবে।
আপনার ক্লায়েন্টকে অবশ্যই সঠিক Authorization হেডার পাঠাতে হবে এবং অনুরোধ অনুমোদন করা থেকে পাওয়া টোকেনের রেফারেন্স দিতে হবে।
রিভিশন ফিড
যেকোনও কন্টেন্ট এন্ট্রির জন্য রিভিশন ইতিহাস পেতে, এন্ট্রির রিভিশন লিঙ্কে একটি HTTP GET পাঠান:
https://sites.google.com/feeds/revision/domainName/siteName/CONTENT_ENTRY_ID
| ফিড প্যারামিটার | বিবরণ |
|---|---|
domainName | 'site' অথবা আপনার G Suite হোস্ট করা ডোমেনের ডোমেন (যেমন, example.com)। |
siteName | আপনার সাইটের ওয়েবস্পেসের নাম; এটি সাইটের URL-এ পাওয়া যায় (যেমন, myCoolSite)। |
কোনও পৃষ্ঠা/কমেন্ট/অ্যাটাচমেন্ট/listitem-এর জন্য রিভিশন লিঙ্ক খুঁজে পেতে, প্রথমে এর CONTENT_ENTRY_ID ব্যবহার করে
কন্টেন্ট ফিড থেকে এন্ট্রিটি রিট্রিভ করুন। ফেরত আনা এন্ট্রিতে রিভিশন ফিডের <atom:link> থাকবে।
যেমন:
<link rel="http://schemas.google.com/sites/2008#revision" type="application/atom+xml"
href="https://sites.google.com/feeds/revision/domainName/siteName/CONTENT_ENTRY_ID"/>
অনুরোধ ও উত্তরের উদাহরণ:
GET /feeds/revision/domainName/siteName/CONTENT_ENTRY_ID HTTP/1.1 Host: sites.google.com GData-Version: 1.4 Authorization: <your authorization header here> HTTP/1.1 200 OK <?xml version="1.0" encoding="UTF-8"?> <feed xmlns="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:sites="http://schemas.google.com/sites/2008" xmlns:gs="http://schemas.google.com/spreadsheets/2006" xmlns:dc="http://purl.org/dc/terms" xmlns:batch="http://schemas.google.com/gdata/batch" xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0"> <id>https://sites.google.com/feeds/revision/domainName/siteName/CONTENT_ENTRY_ID</id> <updated>2009-09-10T04:33:35.337Z</updated> <title>Revisions</title> <link rel="http://schemas.google.com/g/2005#feed" type="application/atom+xml" href="https://sites.google.com/feeds/revision/domainName/siteName/CONTENT_ENTRY_ID"/> <link rel="self" type="application/atom+xml" href="https://sites.google.com/feeds/revision/domainName/siteName/CONTENT_ENTRY_ID"/> <generator version="1" uri="http://sites.google.com">Google Sites</generator> <openSearch:startIndex>1</openSearch:startIndex> <entry gd:etag="W/"CU4GQmA9WxNRFUg.""> <id>https://sites.google.com/feeds/revision/domainName/siteName/CONTENT_ENTRY_ID/2</id> <updated>2009-09-10T03:38:42.045Z</updated> <category scheme="http://schemas.google.com/g/2005#kind" term="http://schemas.google.com/sites/2008#webpage" label="webpage"/> <title>Home</title> <content type="xhtml"> <div xmlns="http://www.w3.org/1999/xhtml">Latest content here</div> </content> <link rel="alternate" type="text/html" href="http://sites.google.com/domainName/siteName/CONTENT_ENTRY_ID/system/app/pages/admin/compare?wuid=wuid%3Agx%3A4f67c7&rev1=2"/> <link rel="self" type="application/atom+xml" href="https://sites.google.com/feeds/revision/domainName/siteName/CONTENT_ENTRY_ID/2"/> <author> <name>User</name> <email>user@gmail.com</email> </author> <sites:pageName>home</sites:pageName> <sites:revision>2</sites:revision> </entry> <entry gd:etag="W/"CU8DQ388eSl7ImA9WxNRFUg.""> <id>https://sites.google.com/feeds/revision/domainName/siteName/CONTENT_ENTRY_ID/1</id> <updated>2009-09-10T03:37:52.171Z</updated> <category scheme="http://schemas.google.com/g/2005#kind" term="http://schemas.google.com/sites/2008#webpage" label="webpage"/> <title>Home</title> <content type="xhtml"> <div xmlns="http://www.w3.org/1999/xhtml">Older content here</div> </content> <link rel="alternate" type="text/html" href="http://sites.google.com/domainName/siteName/CONTENT_ENTRY_ID/system/app/pages/admin/compare?wuid=wuid%3Agx%3A4bc7&rev1=1"/> <link rel="self" type="application/atom+xml" href="https://sites.google.com/feeds/revision/domainName/siteName/CONTENT_ENTRY_ID/1"/> <author> <name>User</name> <email>user@gmail.com</email> </author> <sites:pageName>home</sites:pageName> <sites:revision>1</sites:revision> </entry> </feed>
মনে রাখবেন: এই ফিড অ্যাক্সেস করতে হলে আপনাকে সাইটের মালিক বা কোল্যাবরেটর হতে হবে।
আপনার ক্লায়েন্টকে অবশ্যই সঠিক Authorization হেডার পাঠাতে হবে এবং অনুরোধ অনুমোদন করা থেকে পাওয়া টোকেনের রেফারেন্স দিতে হবে।
কন্টেন্ট ফিড
কন্টেন্ট ফিরিয়ে আনা
কন্টেন্ট ফিডে সাইটের বর্তমান কন্টেন্টের তালিকা থাকে। নিম্নলিখিত URL-এ একটি যাচাই করা GET অনুরোধ পাঠান:
https://sites.google.com/feeds/content/domainName/siteName
| ফিড প্যারামিটার | বিবরণ |
|---|---|
domainName | 'site' অথবা আপনার G Suite হোস্ট করা ডোমেনের ডোমেন (যেমন, example.com)। |
siteName | আপনার সাইটের ওয়েবস্পেসের নাম; এটি সাইটের URL-এ পাওয়া যায় (যেমন, myCoolSite)। |
ফলাফল হল একটি ফিড যা সাইটের কন্টেন্ট এন্ট্রির প্রথম পৃষ্ঠা তালিকাভুক্ত করে। ফিডের প্রতিটি এন্ট্রি আলাদা আলাদা ধরনের কন্টেন্ট এন্ট্রিকে বোঝায়,
যেমন webpage, filecabinet, attachment, comment ইত্যাদি। <category scheme="http://schemas.google.com/g/2005#kind">
এলিমেন্ট এন্ট্রির ধরন নির্ধারণ করে। সাপোর্ট করা kind ভ্যালুর তালিকা পেতে, রেফারেন্স গাইড
দেখুন।
মনে রাখবেন: সাইটের শেয়ার করার অনুমতির উপর নির্ভর করে এই ফিডে যাচাইকরণ প্রয়োজন হতেও পারে বা নাও হতে পারে।
সাইটটি সর্বজনীন না হলে, আপনার ক্লায়েন্টকে সঠিক Authorization হেডার (উপরে দেওয়া উদাহরণে যেমন দেখা যাচ্ছে)
পাঠাতে হবে এবং অনুরোধ অনুমোদন করা থেকে পাওয়া টোকেনের রেফারেন্স দিতে হবে।
GET /feeds/content/domainName/siteName HTTP/1.1 Host: sites.google.com GData-Version: 1.4 Authorization: <your authorization header here> HTTP/1.1 200 OK <?xml version="1.0" encoding="UTF-8"?> <feed xmlns="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:sites="http://schemas.google.com/sites/2008" xmlns:gs="http://schemas.google.com/spreadsheets/2006" xmlns:dc="http://purl.org/dc/terms" xmlns:batch="http://schemas.google.com/gdata/batch" xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0"> <id>https://sites.google.com/feeds/content/domainName/siteName</id> <updated>2009-08-31T01:39:20.286Z</updated> <title>Content</title> <link rel="http://schemas.google.com/g/2005#feed" type="application/atom+xml" href="https://sites.google.com/feeds/content/domainName/siteName"/> <link rel="http://schemas.google.com/g/2005#post" type="application/atom+xml" href="https://sites.google.com/feeds/content/domainName/siteName"/> <link rel="self" type="application/atom+xml" href="https://sites.google.com/feeds/content/domainName/siteName"/> <link rel="http://schemas.google.com/g/2005#batch" type="application/atom+xml" href="https://sites.google.com/feeds/content/domainName/siteName/batch""/> <link rel="next" type="application/atom+xml" href="https://sites.google.com/feeds/content/domainName/siteName/?start-index=2"/> <generator version="1" uri="http://sites.google.com">Google Sites</generator> <openSearch:startIndex>1</openSearch:startIndex> <entry gd:etag="W/"Ck8GQXk7fil7ImA9WxNSFk0.""> <id>https://sites.google.com/feeds/content/domainName/siteName/7322156894</id> <updated>2009-08-30T02:53:40.706Z</updated> <app:edited xmlns:app="http://www.w3.org/2007/app">2009-08-30T02:53:40.706Z</app:edited> <category scheme="http://schemas.google.com/g/2005#kind" term="http://schemas.google.com/sites/2008#webpage" label="webpage"/> <title>Subpage</title> <content type="xhtml"> <div xmlns="http://www.w3.org/1999/xhtml">Page html content here</div> </content> <link rel="http://schemas.google.com/sites/2008#parent" type="application/atom+xml" href="https://sites.google.com/feeds/content/domainName/siteName/6492205817"/> <link rel="alternate" type="text" href="http://sites.google.com/site/siteName/subpage"/> <link rel="http://schemas.google.com/sites/2008#revision" type="application/atom+xml" href="https://sites.google.com/feeds/revision/domainName/siteName/7322156894"/> <link rel="self" type="application/atom+xml" href="https://sites.google.com/feeds/content/domainName/siteName/7322156894"/> <link rel="edit" type="application/atom+xml" href="https://sites.google.com/feeds/content/domainName/siteName/7322156894"/> <author> <name>User</name> <email>user@gmail.com</email> </author> <sites:pageName>subpage</sites:pageName> <sites:revision>5</sites:revision> </entry> <entry gd:etag="W/"CkMBQH08fCl7ImA9WxNSFk0.""> <id>https://sites.google.com/feeds/content/domainName/siteName/5930635231</id> <updated>2009-08-30T02:47:31.374Z</updated> <app:edited xmlns:app="http://www.w3.org/2007/app">2009-08-30T02:47:31.374Z</app:edited> <category scheme="http://schemas.google.com/g/2005#kind" term="http://schemas.google.com/sites/2008#listitem" label="listpage"/> <title/> <link rel="http://schemas.google.com/sites/2008#parent" type="application/atom+xml" href="https://sites.google.com/feeds/content/domainName/siteName/5930635231"/> <link rel="http://schemas.google.com/sites/2008#revision" type="application/atom+xml" href="https://sites.google.com/feeds/revision/domainName/siteName/5930635231"/> <link rel="self" type="application/atom+xml" href="https://sites.google.com/feeds/content/domainName/siteName/5930635231"/> <link rel="edit" type="application/atom+xml" href="https://sites.google.com/feeds/content/domainName/siteName/5930635231"/> <author> <name>User</name> <email>user@gmail.com</email> </author> <sites:revision>1</sites:revision> <gs:field index="A" name="Issue/Feature">Implement cool feature X</gs:field> <gs:field index="B" name="Priority">P2</gs:field> <gs:field index="C" name="Owner"/> <gs:field index="D" name="Resolved"/> </entry> <entry gd:etag="W/"AkYHQ3ozcCl7ImA9WxJaE08.""> <id>https://sites.google.com/feeds/content/domainName/siteName/1265948545471894517</id> <updated>2009-08-03T19:35:32.488Z</updated> <app:edited xmlns:app="http://www.w3.org/2007/app">2009-08-03T19:35:32.488Z</app:edited> <category scheme="http://schemas.google.com/g/2005#kind" term="http://schemas.google.com/sites/2008#filecabinet" label="filecabinet"/> <title>files</title> <content type="xhtml"> <div xmlns="http://www.w3.org/1999/xhtml">Page html content here</div> </content> <link rel="alternate" type="text" href="https://sites.google.com/domainName/siteName/files"/> <link rel="http://schemas.google.com/sites/2008#revision" type="application/atom+xml" href="https://sites.google.com/feeds/revision/domainName/siteName/12671894517"/> <link rel="self" type="application/atom+xml" href="https://sites.google.com/feeds/content/domainName/siteName/12671894517"/> <link rel="edit" type="application/atom+xml" href="https://sites.google.com/feeds/content/domainName/siteName/12671894517"/> <author> <name>User</name> <email>user@gmail.com</email> </author> <gd:feedLink href="httpn://sites.google.com/feeds/content/domainName/siteName?parent=12671894517"/> <sites:pageName>files</sites:pageName> <sites:revision>1</sites:revision> </entry> ... </feed>
মনে রাখবেন: এটি শুধুমাত্র প্রথম কয়েকটি ফলাফল। সম্পূর্ণ কন্টেন্ট ফিড জুড়ে পৃষ্ঠা দেখতে, ফিডের 'পরবর্তী' লিঙ্কে ক্লিক করুন:
<link rel="next" type="application/atom+xml" href="https://sites.google.com/feeds/content/domainName/siteName/?start-index=2"/>
Atom-এর সাধারণ এলিমেন্ট সম্পর্কে জানতে, Google ডেটা প্রোটোকল রেফারেন্স দেখুন।
ক্লাসিক Sites API-এর জন্য নির্দিষ্ট অর্থ আছে এমন এলিমেন্ট নিচে বর্ণনা করা হল। নির্দিষ্ট কিছু এন্ট্রি অতিরিক্ত প্রপার্টি (নিচে তালিকাভুক্ত নয়) সহ থাকবে, তবে
অন্যগুলি থাকবে না। যেমন, listitem এন্ট্রিতে <gs:field> এলিমেন্ট থাকতে পারে, কিন্তু webpage এন্ট্রিতে তা থাকে না।
| এলিমেন্ট | বিবরণ |
|---|---|
<content ...> | ভেতরের টেক্সট হল পৃষ্ঠার HTML বডি। কিছু এন্ট্রির (যেমন, অ্যাটাচমেন্ট) ক্ষেত্রে, এই এলিমেন্টে ফাইলের দিকে পয়েন্ট করা একটি src অ্যাট্রিবিউট থাকবে। |
<link rel="alternate" ...> | Google Sites-এ পৃষ্ঠা বা আইটেমের লিঙ্ক। |
<link rel="http://schemas.google.com/sites/2008#revision" ...> | href অ্যাট্রিবিউট এন্ট্রির রিভিশন ফিডের দিকে পয়েন্ট করে। |
<link rel="http://schemas.google.com/sites/2008#parent" ...> | href অ্যাট্রিবিউট এন্ট্রির পেরেন্ট এন্ট্রির দিকে পয়েন্ট করে। |
<link rel="http://schemas.google.com/sites/2008#template" ...> | এন্ট্রির টেমপ্লেট পৃষ্ঠায় href অ্যাট্রিবিউট পয়েন্ট। |
<category scheme="http://schemas.google.com/g/2005#kind" ...> | label হল এন্ট্রির ধরন। |
<category term="http://schemas.google.com/g/2005#template" ...> | label=template চিহ্নটি বোঝায় যে এন্ট্রিটি একটি টেমপ্লেট। |
<gd:feedLink> | href অ্যাট্রিবিউট এন্ট্রির পেরেন্টের সন্তানদের দিকে নির্দেশ করে। |
<sites:pageName> | পৃষ্ঠার ওয়েবস্পেসের নাম; পৃষ্ঠার URL-এ থাকা নামের সাথে সংশ্লিষ্ট। |
<sites:revision> | বর্তমান রিভিশন নম্বর। |
কন্টেন্ট ফিড কোয়েরির উদাহরণ
আপনি স্ট্যান্ডার্ড Google Data API কোয়েরি প্যারামিটার এবং ক্লাসিক Sites API-এর জন্য নির্দিষ্ট প্যারামিটার ব্যবহার করে কন্টেন্ট ফিড সার্চ করতে পারবেন। আরও বিস্তারিত তথ্য ও কাজ করে এমন প্যারামিটারের সম্পূর্ণ তালিকা পেতে, রেফারেন্স গাইড দেখুন।
নির্দিষ্ট ধরনের এন্ট্রি রিট্রিভ করা
শুধুমাত্র নির্দিষ্ট ধরনের এন্ট্রি ফেচ করতে, kind প্যারামিটার ব্যবহার করুন। এই উদাহরণে শুধু webpage এন্ট্রি দেখানো হয়েছে:
GET /feeds/content/domainName/siteName?kind=webpage
একাধিক এন্ট্রি টাইপ রিটার্ন করতে, প্রতিটি kind-কে ',' দিয়ে আলাদা করুন। এই উদাহরণে filecabinet এবং
listpage এন্ট্রি রিটার্ন করা হয়েছে:
GET /feeds/content/domainName/siteName?kind=filecabinet,listpage
অথবা, আপনি kind প্যারামিটারের পরিবর্তে Google Data /-/category কোয়েরির জন্য স্ট্যান্ডার্ড ফর্ম্যাট ব্যবহার করতে পারেন:
GET /feeds/content/domainName/siteName/-/filecabinet|listpage
পৃষ্ঠার টেমপ্লেট রিট্রিভ করা হচ্ছে
এই উদাহরণে শুধুমাত্র template পৃষ্ঠা দেখানো হয়েছে:
GET /feeds/content/domainName/siteName/-/template
সব ধরনের এন্ট্রি ফেরত পেতে এবং template পৃষ্ঠা অন্তর্ভুক্ত করতে, এগুলি ব্যবহার করুন:
GET /feeds/content/domainName/siteName/-/template|-template
পাথ ব্যবহার করে পৃষ্ঠা ফিরিয়ে আনা
Google সাইটের মধ্যে কোনও পৃষ্ঠার আপেক্ষিক পাথ জানা থাকলে, সেই নির্দিষ্ট পৃষ্ঠাটি পেতে আপনি path প্যারামিটার ব্যবহার করতে পারবেন।
এই উদাহরণটি
http://sites.google.com/site/siteName/path/to/the/page-এ থাকা পৃষ্ঠাটি রিটার্ন করবে:
GET /feeds/content/domainName/siteName?path=/path/to/the/page
মূল পৃষ্ঠার অধীনে থাকা সব এন্ট্রি রিট্রিভ করা
আপনি যদি কোনও পৃষ্ঠার এন্ট্রি আইডি জানেন, তাহলে এর সমস্ত চাইল্ড এন্ট্রি (যদি থাকে) পেতে parent প্যারামিটার ব্যবহার করতে পারেন:
GET /feeds/content/domainName/siteName?parent=CONTENT_ENTRY_ID
ড্রাফ্ট বা মুছে দেওয়া এন্ট্রি সহ
ড্রাফ্ট বা মুছে দেওয়া এন্ট্রি অন্তর্ভুক্ত করতে, যথাক্রমে include-drafts বা include-deleted প্যারামিটার ব্যবহার করুন।
এই উদাহরণে কন্টেন্ট ফিডে ড্রাফ্ট এন্ট্রি অন্তর্ভুক্ত আছে:
GET /feeds/content/domainName/siteName?include-drafts=true
সম্পূর্ণ টেক্সট সার্চ
সাইটের সম্পূর্ণ কন্টেন্ট জুড়ে সার্চ করতে, সম্পূর্ণ টেক্সট সার্চ ইস্যু করতে q প্যারামিটার ব্যবহার করুন:
GET /feeds/content/domainName/siteName?q=Text%20I%20am%20looking%20for
কন্টেন্ট তৈরি করা
HTTP POST
কন্টেন্ট ফিডে পাঠিয়ে নতুন কন্টেন্ট (ওয়েবপেজ, লিস্টপেজ, ফাইলক্যাবিনেট পেজ, ঘোষণা সংক্রান্ত পেজ ইত্যাদি) তৈরি করা যেতে পারে:
https://sites.google.com/feeds/content/domainName/siteName
কাজ করে এমন এন্ট্রি ধরনের তালিকা পেতে, রেফারেন্স গাইডে kind প্যারামিটার দেখুন।
নতুন আইটেম / পৃষ্ঠা তৈরি করা
এই উদাহরণটি সাইটের টপ-লেভেলের অধীনে একটি নতুন webpage তৈরি করে, পৃষ্ঠার বডির জন্য কিছু XHTML অন্তর্ভুক্ত করে
এবং হেডিংয়ের শীর্ষক 'নতুন ওয়েবপেজের শীর্ষক' হিসেবে সেট করে:
POST /feeds/content/domainName/siteName HTTP/1.1 Host: sites.google.com GData-Version: 1.4 Authorization: <your authorization header here> Content-Length: 328 Content-Type: application/atom+xml <entry xmlns="http://www.w3.org/2005/Atom"> <category scheme="http://schemas.google.com/g/2005#kind" term="http://schemas.google.com/sites/2008#webpage" label="webpage"/> <title>New Webpage Title</title> <content type="xhtml"> <div xmlns="http://www.w3.org/1999/xhtml">HTML body goes here</div> </content> </entry>
সফল হলে, সার্ভার 201 Created ও এন্ট্রির একটি কপি সহ উত্তর দেয়।
কাস্টম URL পাথের অধীনে আইটেম/পৃষ্ঠা তৈরি করা
ডিফল্ট হিসেবে, আগের উদাহরণটি URL
http://sites.google.com/domainName/siteName/new-webpage-title-এর অধীনে তৈরি করা হবে এবং
এটির পৃষ্ঠার শিরোনাম হবে 'নতুন ওয়েবপেজের নাম'। অর্থাৎ, URL-এর জন্য <atom:title>-কে new-webpage-title-এ নর্মালাইজ করা হয়।
কোনও পৃষ্ঠার URL পাথ কাস্টমাইজ করতে, আপনি <sites:pageName> এলিমেন্ট সেট করতে পারবেন।
এই উদাহরণে 'ফাইল স্টোরেজ' পৃষ্ঠার শিরোনাম সহ একটি নতুন filecabinet তৈরি করা হয়েছে, কিন্তু <sites:pageName> এলিমেন্ট নির্দিষ্ট করে
http://sites.google.com/domainName/siteName/files URL-এর অধীনে
পৃষ্ঠাটি তৈরি করা হয়েছে।
POST /feeds/content/domainName/siteName HTTP/1.1 Host: sites.google.com GData-Version: 1.4 Authorization: <your authorization header here> Content-Length: 393 Content-Type: application/atom+xml <entry xmlns="http://www.w3.org/2005/Atom" xmlns:sites="http://schemas.google.com/sites/2008"> <category scheme="http://schemas.google.com/g/2005#kind" term="http://schemas.google.com/sites/2008#filecabinet" label="filecabinet"/> <title>File Storage</title> <content type="xhtml"> <div xmlns="http://www.w3.org/1999/xhtml">A list of files is below.</div> </content> <sites:pageName>files</sites:pageName> </entry>
কোনও পৃষ্ঠার URL পাথের নাম দেওয়ার জন্য সার্ভার নিম্নলিখিত অগ্রাধিকার সংক্রান্ত নিয়ম ব্যবহার করে:
<sites:pageName>, যদি থাকে।a-z, A-Z, 0-9, -, _শর্ত পূরণ করতে হবে।<atom:title>, pageName না থাকলে এটি ফাঁকা রাখা যাবে না। '-' এবং একাধিক স্পেসকে একটি স্পেসে পরিবর্তন করা এবংa-z, A-Z, 0-9, -, _-এর সাথে ম্যাচ না করা অক্ষর সরিয়ে দেওয়াকে নরমালাইজেশন বলে।
যেমন, 'Custom_Page2' সার্ভার গ্রহণ করবে।
সাবপেজ তৈরি করা
মূল পৃষ্ঠার অধীনে সাবপেজ (চাইল্ড) তৈরি করতে, আপনার
নতুন Atom এন্ট্রিতে একটি <link rel="http://schemas.google.com/sites/2008#parent"> যোগ করুন। লিঙ্কের href অ্যাট্রিবিউটকে মূল এন্ট্রির সেল্ফ লিঙ্কে সেট করুন।
এই উদাহরণে, এন্ট্রি
ID PARENT_ENTRY_ID সহ মূল ঘোষণা পৃষ্ঠার অধীনে 'ঘোষণা' শীর্ষক একটি নতুন announcement তৈরি করা হয়েছে। এছাড়াও, পৃষ্ঠার বডির জন্য XHTML কন্টেন্ট অন্তর্ভুক্ত করা হয়েছে:
POST /feeds/content/domainName/siteName HTTP/1.1 Host: sites.google.com GData-Version: 1.4 Authorization: <your authorization header here> Content-Length: 470 Content-Type: application/atom+xml <entry xmlns="http://www.w3.org/2005/Atom"> <category scheme="http://schemas.google.com/g/2005#kind" term="http://schemas.google.com/sites/2008#announcement" label="announcement"/> <link rel="http://schemas.google.com/sites/2008#parent" type="application/atom+xml" href="https://sites.google.com/feeds/content/domainName/siteName/PARENT_ENTRY_ID"/> <title>announcement</title> <content type="xhtml"> <div xmlns="http://www.w3.org/1999/xhtml">This weekend. My place.</div> </content> </entry>
পৃষ্ঠার টেমপ্লেট
পৃষ্ঠার টেমপ্লেট তৈরি করা
নতুন আইটেম/পৃষ্ঠা তৈরি করা এবং
সাবপেজ তৈরি করার প্রসেস একই। পার্থক্য হল, category-এর সাথে 'http://schemas.google.com/g/2005#template' এবং 'template' শব্দ ও লেবেল যোগ করা হয়েছে
যা যথাক্রমে সেট করা আছে।
এই উদাহরণে একটি নতুন webpage টেমপ্লেট তৈরি করা হয়েছে।
POST /feeds/content/domainName/siteName HTTP/1.1 Host: sites.google.com GData-Version: 1.4 Authorization: <your authorization header here> Content-Length: 464 Content-Type: application/atom+xml <entry xmlns="http://www.w3.org/2005/Atom" xmlns:sites="http://schemas.google.com/sites/2008"> <category scheme="http://schemas.google.com/g/2005#kind" term="http://schemas.google.com/sites/2008#webpage" label="webpage"/> <category scheme="http://schemas.google.com/g/2005#labels" term="http://schemas.google.com/g/2005#template" label="template"/> <title>Webpage Template</title> <content type="xhtml"> <div xmlns="http://www.w3.org/1999/xhtml">This weekend. My place.</div> </content> </entry>
টেমপ্লেট থেকে পৃষ্ঠা তৈরি করা
পেজ টেমপ্লেট তৈরি করার মতোই, আপনি কোনও টেমপ্লেট থেকে নতুন পেজ ইনস্ট্যানশিয়েট করতে পারেন। এর জন্য, পেজ টেমপ্লেটের সেল্ফ লিঙ্কের দিকে পয়েন্ট করা <link>-এর মধ্যে rel='http://schemas.google.com/sites/2008#template' যোগ করুন।
এই উদাহরণে, আগে থেকে থাকা পৃষ্ঠা টেমপ্লেট থেকে একটি নতুন filecabinet পৃষ্ঠা তৈরি করা হয়েছে, যা একটি ফাইলক্যাবিনেটকে সংজ্ঞায়িত করে।
POST /feeds/content/domainName/siteName HTTP/1.1 Host: sites.google.com GData-Version: 1.4 Authorization: <your authorization header here> Content-Length: 464 Content-Type: application/atom+xml <entry xmlns="http://www.w3.org/2005/Atom" xmlns:sites="http://schemas.google.com/sites/2008"> <category scheme="http://schemas.google.com/g/2005#kind" term="http://schemas.google.com/sites/2008#filecabinet" label="filecabinet"/> <title>File Cabinet Page From Template</title> <link rel='http://schemas.google.com/sites/2008#template' type='application/atom+xml' href='https://sites.google.com/feeds/content/domainName/siteName/ENTRY_ID'/> </entry>
মনে রাখবেন: টেমপ্লেটে <category> উল্লেখ করা থাকলেও, আপনার
এন্ট্রিতে এটি যোগ করতে হবে। এছাড়াও, মনে রাখবেন, আপনি <content> এলিমেন্ট যোগ করলে, সার্ভার সেটি বাতিল করে দেবে।
ফাইল আপলোড করা হচ্ছে
Google Sites-এর মতোই, API আপনাকে ফাইল ক্যাবিনেট পৃষ্ঠা ও মূল পৃষ্ঠায় অ্যাটাচমেন্ট আপলোড করার অনুমতি দেয়।
অভিভাবকের কাছে অ্যাটাচমেন্ট আপলোড করতে, কন্টেন্ট ফিড URL-এ HTTP POST অনুরোধ পাঠান:
https://sites.google.com/feeds/content/domainName/siteName
POST বডিকে অবশ্যই MIME মাল্টিপার্ট অনুরোধ হতে হবে, যাতে অ্যাটাচমেন্টের মেটাডেটা সহ
<atom:entry> ফাইল কন্টেন্টকে একত্রিত করা যায়। <atom:entry>-এ অ্যাটাচমেন্ট কোথায় তৈরি করা হবে তা নির্দিষ্ট করতে
প্যারেন্ট এন্ট্রির সেল্ফ লিঙ্কের রেফারেন্স থাকতে হবে।
আরও তথ্যের জন্য সাবপেজ তৈরি করা দেখুন।
অ্যাটাচমেন্ট আপলোড করা হচ্ছে
PARENT_ENTRY_ID আইডি সহ ফাইল ক্যাবিনেটে PDF ফাইল আপলোড করার একটি উদাহরণ এখানে দেওয়া হল। 'PDF ফাইল' শীর্ষক এবং 'HR প্যাকেট' (ঐচ্ছিক) বিবরণ সহ
অ্যাটাচমেন্ট তৈরি করা হবে।
POST /feeds/content/domainName/siteName HTTP/1.1 Host: sites.google.com GData-Version: 1.4 Authorization: <your authorization header here> Content-Length: 7221984 Content-Type: multipart/related; boundary=END_OF_PART --END_OF_PART Content-Type: application/atom+xml <entry xmlns="http://www.w3.org/2005/Atom"> <category scheme="http://schemas.google.com/g/2005#kind" term="http://schemas.google.com/sites/2008#attachment" label="attachment"/> <link rel="http://schemas.google.com/sites/2008#parent" type="application/atom+xml" href="https://sites.google.com/feeds/content/domainName/siteName/PARENT_ENTRY_ID"/> <title>PDF File</title> <summary>HR packet</summary> </entry> --END_OF_PART Content-Type: application/pdf ... pdf contents here ... --END_OF_PART--
আপলোড সফল হলে, সার্ভার 201 Created এবং নতুন তৈরি অ্যাটাচমেন্ট এন্ট্রির একটি কপি সহ উত্তর দেবে।
ফোল্ডারে অ্যাটাচমেন্ট আপলোড করা
filecabinet-এ আগে থেকে থাকা ফোল্ডারে অ্যাটাচমেন্ট আপলোড করতে, ফোল্ডারের নামে সেট করা 'term' অ্যাট্রিবিউট সহ একটি বিভাগ যোগ করুন:
<category scheme="http://schemas.google.com/sites/2008#folder" term="FolderName">ওয়েব অ্যাটাচমেন্ট
ওয়েব অ্যাটাচমেন্ট হল বিশেষ ধরনের অ্যাটাচমেন্ট। মূলত, এগুলি হল ওয়েবে থাকা অন্যান্য ফাইলের লিঙ্ক যেগুলি আপনি নিজের ফাইলক্যাবিনেট লিস্টে যোগ করতে পারেন। এই ফিচারটি Google Sites UI-তে 'URL-এর মাধ্যমে ফাইল যোগ করুন' আপলোড পদ্ধতির মতো।
মনে রাখবেন: ওয়েব অ্যাটাচমেন্ট শুধুমাত্র ফাইল ক্যাবিনেটের অধীনে তৈরি করা যায়। এগুলি অন্য ধরনের পৃষ্ঠায় আপলোড করা যায় না।
এই উদাহরণে ID FILECABINET_ENTRY_ID-এর মাধ্যমে রেফারেন্স করা ফাইলক্যাবিনেটের অধীনে webattachment তৈরি করা হয়েছে।
এর নাম ও (ঐচ্ছিক) বিবরণ যথাক্রমে 'GoogleLogo' ও 'nice colors' হিসেবে সেট করা আছে।
POST /feeds/content/domainName/siteName HTTP/1.1 Host: sites.google.com GData-Version: 1.4 Authorization: <your authorization header here> Content-Type: application/atom+xml Content-Length: 531 <entry xmlns="http://www.w3.org/2005/Atom"> <category scheme="http://schemas.google.com/g/2005#kind" term="http://schemas.google.com/sites/2008#webattachment" label="webattachment"/> <link rel="http://schemas.google.com/sites/2008#parent" type="application/atom+xml" href="https://sites.google.com/feeds/content/domainName/siteName/FILECABINET_ENTRY_ID"/> <title>GoogleLogo</title> <summary>nice colors</summary> <content type="image/gif" src="http://www.google.com/images/logo.gif"></content> </entry>
POST ব্যবহারকারীর ফাইল ক্যাবিনেটে একটি লিঙ্ক তৈরি করে যা 'http://www.google.com/images/logo.gif'-এ থাকা ছবিটির দিকে পয়েন্ট করে।
কন্টেন্ট আপডেট করা
edit লিঙ্কে একটি PUT অনুরোধের মাধ্যমে যেকোনও পৃষ্ঠার মেটাডেটা (নাম, pageName ইত্যাদি) এবং পৃষ্ঠার কন্টেন্ট এডিট করা যেতে পারে।
অনুরোধের বডিতে আপডেট করা পৃষ্ঠার বিবরণ সহ একটি Atom এন্ট্রি থাকতে হবে। এই নিয়মের ব্যতিক্রম হল অ্যাটাচমেন্ট এন্ট্রি, যেখানে এন্ট্রিটি শুধুমাত্র অ্যাটাচমেন্টের মেটাডেটা আপডেট করতে ব্যবহার করা যেতে পারে।
অ্যাটাচ করা ফাইলের কন্টেন্ট পরিবর্তন করতে, PUT অনুরোধের বডি হিসেবে কাঁচা ডেটা যোগ করুন
অ্যাটাচমেন্টের edit-media লিঙ্ক। এছাড়াও, আপনি MIME মাল্টিপার্ট অনুরোধ ব্যবহার করে মেটাডেটা এবং অ্যাটাচ করা ফাইলের কন্টেন্ট, দুটিই একসাথে আপডেট করতে পারবেন।
আপনার আপডেট অন্য ক্লায়েন্টের করা পরিবর্তন ওভাররাইট করে না তা নিশ্চিত করতে, আসল এন্ট্রির ETag ভ্যালু অন্তর্ভুক্ত করুন। আপনি এটি করতে পারেন
HTTP If-Match হেডারে ETag ভ্যালু প্রদান করে অথবা আপডেট করা এন্ট্রিতে
মূল এন্ট্রির gd:etag অ্যাট্রিবিউট অন্তর্ভুক্ত করে। মূল এন্ট্রির ETag ভ্যালু নির্ধারণ করতে, <entry> এলিমেন্টের gd:etag অ্যাট্রিবিউট পরীক্ষা করুন।
মিডিয়া এন্ট্রির জন্য, মিডিয়ার ETag edit-media লিঙ্কের gd:etag অ্যাট্রিবিউটে উপলভ্য থাকতে পারে।
আপনি যদি এন্ট্রি আপডেট করতে চান, তা সে আপনি এটি রিট্রিভ করার পর অন্য কেউ এটি আপডেট করে থাকুক বা না থাকুক, তাহলে
If-Match: * ব্যবহার করুন এবং ETag অন্তর্ভুক্ত করবেন না। ETag সম্পর্কে আরও জানতে, Google Data API রেফারেন্স গাইড দেখুন।
কোনও আইটেমের মেটাডেটা বা HTML কন্টেন্ট আপডেট করা
কোনও এন্ট্রির মেটাডেটা বা HTML কন্টেন্ট আপডেট করতে, এন্ট্রির edit লিঙ্কে একটি HTTP PUT পাঠান।
নিচে listpage এন্ট্রি (এর আইডি ENTRY_ID) আপডেট করার একটি উদাহরণ দেওয়া হল, যেখানে নিম্নলিখিত পরিবর্তন করা হয়েছে:
- নাম পরিবর্তন করে 'আপডেট করা কন্টেন্ট' করা হয়েছে
- আপডেট করা HTML কন্টেন্ট
- তালিকার প্রথম কলামের শিরোনাম আপডেট করে 'মালিক' করা হয়েছে
<sites:pageName>এলিমেন্ট দ্বারা পৃষ্ঠার URL পাথ পরিবর্তন করা হয়েছে
PUT /feeds/content/domainName/siteName/ENTRY_ID Host: sites.google.com GData-Version: 1.4 Authorization: <your authorization header here> Content-Length: 816 Content-Type: application/atom+xml <entry xmlns="http://www.w3.org/2005/Atom" xmlns:sites="http://schemas.google.com/sites/2008" xmlns:gs="http://schemas.google.com/spreadsheets/2006" xmlns:gd="http://schemas.google.com/g/2005" gd:etag="W/"CEEBRn0ymA9WxJWEUw.""> <category scheme="http://schemas.google.com/g/2005#kind" term="http://schemas.google.com/sites/2008#listpage" label="listpage"/> <title>Updated Title</title> <content type="xhtml"> <div xmlns="http://www.w3.org/1999/xhtml">Updated Content</div> </content> <gs:worksheet name="listpage"/> <gs:header row="1"/> <gs:data startRow="2"> <gs:column index="A" name="Owner"/> <gs:column index="B" name="Description"/> <gs:column index="C" name="Completed"/> </gs:data> <sites:pageName>newPagePath</sites:pageName> </entry>
মনে রাখবেন: এন্ট্রি (সার্ভারের দেওয়া উত্তর অনুযায়ী) উপরের উদাহরণের চেয়ে বেশি এলিমেন্ট কন্টেন করবে।
অ্যাটাচমেন্টের কন্টেন্ট পরিবর্তন করা
নিচে অ্যাটাচমেন্টের কন্টেন্ট পরিবর্তন করার একটি উদাহরণ দেওয়া হল, তবে এর মেটাডেটা অপরিবর্তিত রাখা হয়েছে। অনুরোধে নতুন কন্টেন্ট থাকায়,
অ্যাটাচমেন্ট এন্ট্রির edit-media লিঙ্ক ব্যবহার করা হয়।
PUT /feeds/media/content/domainName/siteName/ATTACHMENT_ENTRY_ID Host: sites.google.com GData-Version: 1.4 Authorization: <your authorization header here> Content-Length: 70581 Content-Type: application/msword ... doc contents here ...
অ্যাটাচমেন্টের মেটাডেটা + কন্টেন্ট আপডেট করা
নিচে অ্যাটাচমেন্টের মেটাডেটা ও কন্টেন্ট একসাথে আপডেট করার একটি উদাহরণ দেওয়া হল। অ্যাটাচমেন্টের নাম আপডেট করে 'নতুন নাম' করা হবে এবং এর কন্টেন্ট .zip ফাইলের কন্টেন্ট দিয়ে পাল্টে দেওয়া হবে। অনুরোধে নতুন ফাইল কন্টেন্ট থাকায়, অ্যাটাচমেন্ট এন্ট্রির edit-media লিঙ্ক ব্যবহার করা হয়েছে।
মনে রাখবেন, মেটাডেটার জন্য ETag অন্তর্ভুক্ত করলে, মিডিয়া কন্টেন্টের জন্য একটি অন্তর্নিহিত If-Match প্রদান করা হয়, কারণ
মিডিয়া কন্টেন্টে কোনও আপডেট করা হলে, মেটাডেটার ETag পরিবর্তন হয়ে যায়।
PUT /feeds/media/content/domainName/siteName/ATTACHMENT_ENTRY_ID Host: sites.google.com GData-Version: 1.4 Authorization: <your authorization header here> Content-Type: multipart/related; boundary="END_OF_PART" --END_OF_PART Content-Type: application/atom+xml <?xml version='1.0' encoding='UTF-8'?> <entry xmlns="http://www.w3.org/2005/Atom" xmlns:gd="http://schemas.google.com/g/2005" gd:etag="BxAaTxRZAyp7ImBq"> <link rel="http://schemas.google.com/sites/2008#parent" type="application/atom+xml" href="https://sites.google.com/feeds/content/domainName/siteName/ATTACHMENT_ENTRY_ID"/> <title>New Title</title> </entry> --END_OF_PART Content-Type: application/zip ... zip contents here ... --END_OF_PART
কন্টেন্ট মুছে দেওয়া
Google Site থেকে কোনও আইটেম সরাতে, প্রথমে এন্ট্রিটি রিট্রিভ করুন, তারপর এন্ট্রির edit URL-এ DELETE
অনুরোধ পাঠান। কোনও আইটেমের মেটাডেটা বা HTML কন্টেন্ট আপডেট করার সময় এই একই URL ব্যবহার করা হয়।
DELETE /feeds/content/domainName/siteName/ENTRY_ID Host: sites.google.com GData-Version: 1.4 Authorization: <your authorization header here> If-Match: <ETag or * here>
এন্ট্রিটি সফলভাবে মুছে দেওয়া হলে, সার্ভার HTTP 200 OK কোড সহ উত্তর দেয়।
আপনি যদি এটি নিশ্চিত করতে চান যে আপনি এমন কোনও এন্ট্রি মুছে ফেলবেন না যা আপনি এটি পুনরুদ্ধার করার পর থেকে অন্য ক্লায়েন্ট দ্বারা পরিবর্তন করা হয়েছে, তাহলে একটি
HTTP If-Match হেডার অন্তর্ভুক্ত করুন যাতে মূল এন্ট্রির ETag মান থাকে। আপনি <entry> এলিমেন্টের gd:etag অ্যাট্রিবিউট পরীক্ষা করে
মূল এন্ট্রির ETag ভ্যালু নির্ধারণ করতে পারবেন।
আপনি যদি এন্ট্রিটি মুছে ফেলতে চান, তা সে আপনি এটি পুনরুদ্ধার করার পর অন্য কেউ আপডেট করে থাকুক বা না থাকুক, তাহলে
If-Match: * ব্যবহার করুন এবং ETag অন্তর্ভুক্ত করবেন না। (এই ক্ষেত্রে, মুছে ফেলার আগে আপনাকে এন্ট্রিটি আর পুনরুদ্ধার করতে হবে না।)
ETags সম্পর্কে আরও তথ্য পেতে, Google Data API রেফারেন্স গাইড দেখুন।
অ্যাটাচমেন্ট ডাউনলোড করা
অ্যাটাচমেন্ট এন্ট্রি হয়ে গেলে, এন্ট্রির
<content> src লিঙ্কে একটি অনুমোদিত HTTP GET পাঠিয়ে আপনি ফাইলটি ডাউনলোড করতে পারবেন। PDF-এর কন্টেন্ট লিঙ্কের উদাহরণ:
<content type="application/pdf" src="http://502377765-a-google-com-s-sites.googlegroups.com/feeds/media/content/domainName/siteName/678942036"/>
ACL ফিড
শেয়ারিং অনুমতি (ACL) সম্পর্কে এক ঝলকে
ACL ফিডে প্রতিটি ACL এন্ট্রি কোনও নির্দিষ্ট এন্টিটির অ্যাক্সেস রোলকে দেখায়, সেটি কোনও ব্যবহারকারী, ব্যবহারকারীর গ্রুপ, ডোমেন বা ডিফল্ট অ্যাক্সেস (যা হল একটি পাবলিক সাইট) হতে পারে। শুধুমাত্র স্পষ্ট অ্যাক্সেস থাকা এন্টিটির জন্য এন্ট্রি দেখানো হবে - Google Sites UI-এর শেয়ারিং স্ক্রিনে "অ্যাক্সেস থাকা লোকজন" প্যানেলে প্রতিটি ইমেল আইডির জন্য একটি করে এন্ট্রি দেখানো হবে। তাই, ডোমেন অ্যাডমিনদের দেখানো হবে না, এমনকি তাদের কাছে কোনও সাইটের ইমপ্লিসিট অ্যাক্সেস থাকলেও।
ভূমিকা
কোনও এন্টিটি যে অ্যাক্সেস লেভেল পেতে পারে, রোল এলিমেন্ট তা বোঝায়। gAcl:role এলিমেন্টের চারটি সম্ভাব্য ভ্যালু আছে:
- পাঠক — একজন দর্শক (শুধুমাত্র পড়ার অ্যাক্সেসের সমতুল্য)।
- লেখক — একজন সহযোগী (পড়া/লেখার অ্যাক্সেসের সমতুল্য)।
- মালিক — সাধারণত সাইট অ্যাডমিন (পড়া/লেখার অ্যাক্সেসের সমতুল্য)।
দূরবীন
স্কোপ এলিমেন্ট সেই এন্টিটিকে বোঝায় যার এই অ্যাক্সেস লেভেল আছে। gAcl:scope এলিমেন্টের সম্ভাব্য পাঁচটি ধরন আছে:
- user — ইমেল আইডি ভ্যালু, যেমন "user@gmail.com"।
- গ্রুপ — Google Group ইমেল আইডি, যেমন "group@domain.com"।
- domain — একটি G Suite ডোমেন নাম, যেমন "domain.com"।
- আমন্ত্রণ জানানো হয়েছে — এমন ব্যবহারকারী যাকে সাইটে আমন্ত্রণ জানানো হয়েছে, কিন্তু এখনও সাইটের ACL-এ যোগ করা হয়নি। (gdata 1.3 বা এর আগের কোনও ভার্সন উল্লেখ করা থাকলে উপলভ্য নয়।)
- default — "default" ধরনের একটিই সম্ভাব্য স্কোপ আছে, যার কোনও ভ্যালু নেই
(যেমন
<gAcl:scope type="default">)। এই নির্দিষ্ট স্কোপটি কোনও ব্যবহারকারীর পাবলিক সাইটে ডিফল্ট হিসেবে থাকা অ্যাক্সেস নিয়ন্ত্রণ করে।
মনে রাখবেন: ডোমেনে "মালিক" অ্যাক্সেস হিসেবে gAcl:role ভ্যালু
সেট করা যাবে না, সেগুলি শুধুমাত্র পাঠক বা লেখক হতে পারে।
"আমন্ত্রণ" স্কোপ সম্পর্কে।
যেসব ব্যবহারকারীর আগে থেকে Google অ্যাকাউন্ট নেই, তাদের ACL-এ যোগ করলে API আমন্ত্রণ জানানোর স্কোপ রিটার্ন করে। API একটি এম্বেড করা টোকেন সহ URL রিটার্ন করে যা আপনাকে আমন্ত্রণ জানানো ব্যবহারকারীদের আমন্ত্রণ গ্রহণ করার অনুমতি দেওয়ার জন্য প্রদান করতে হবে।
এই আমন্ত্রণ জানানোর পদ্ধতি আপনাকে সেইসব ব্যবহারকারীকে আমন্ত্রণ জানাতে দেয় যারা Google ব্যবহার করেন না এবং আপনি আগে থেকে জানেন না যে তারা কোন ইমেল আইডি ব্যবহার করতে চান। ব্যবহারকারীরা যতক্ষণ পর্যন্ত এম্বেড করা টোকেন সহ আমন্ত্রণ URL-এ ক্লিক করছেন, ততক্ষণ পর্যন্ত তারা যে ইমেল আইডি ব্যবহার করতে চান তা দিয়ে অ্যাক্সেসের জন্য সাইন-আপ করতে পারবেন। এছাড়াও, একাধিক ব্যবহারকারী আমন্ত্রণ গ্রহণ করার জন্য এই URL ব্যবহার করতে পারেন, তাই কোনও ব্যবহারকারী বা ব্যবহারকারীর গ্রুপকে আমন্ত্রণ জানানোর ক্ষেত্রে এটি কাজে লাগতে পারে।
মনে রাখবেন: "আমন্ত্রণ জানান" স্কোপ শুধুমাত্র gdata ভার্সন 1.4 ও তার পরবর্তী ভার্সনে উপলভ্য। আপনি যদি স্পষ্টভাবে ১.৩ বা তার কম উল্লেখ করেন, তাহলে এটি কাজ করবে না।
ACL ফিড ফিরিয়ে আনা হচ্ছে
ACL ফিড কোনও সাইটের শেয়ারিং অনুমতি নিয়ন্ত্রণ করতে ব্যবহার করা যেতে পারে এবং এটি নিম্নলিখিত URI-এর মাধ্যমে অ্যাক্সেস করা যায়:
https://sites.google.com/feeds/acl/site/domainName/siteName
| ফিড প্যারামিটার | বিবরণ |
|---|---|
domainName | 'site' অথবা আপনার G Suite হোস্ট করা ডোমেনের ডোমেন (যেমন, example.com)। |
siteName | আপনার সাইটের ওয়েবস্পেসের নাম; এটি সাইটের URL-এ পাওয়া যায় (যেমন, myCoolSite)। |
এটি মনে রাখা গুরুত্বপূর্ণ যে সাইট ফিডের প্রতিটি এন্ট্রিতে এই ফিডের একটি লিঙ্ক থাকে:
<link rel="http://schemas.google.com/acl/2007#accessControlList" type="application/atom+xml"
href="https://sites.google.com/feeds/acl/site/domainName/siteName"/>
সাইটের শেয়ারিং অনুমতি পেতে, ACL ফিড URI-তে একটি HTTP GET পাঠান:
GET /feeds/acl/site/domainName/siteName HTTP/1.1 Host: sites.google.com GData-Version: 1.4 Authorization: <your authorization header here>
সার্ভার 200 OK এবং ACL এন্ট্রির ফিড সহ উত্তর দেবে:
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/"
xmlns:gAcl="http://schemas.google.com/acl/2007" xmlns:sites="http://schemas.google.com/sites/2008"
xmlns:gs="http://schemas.google.com/spreadsheets/2006" xmlns:dc="http://purl.org/dc/terms"
xmlns:batch="http://schemas.google.com/gdata/batch" xmlns:gd="http://schemas.google.com/g/2005"
xmlns:thr="http://purl.org/syndication/thread/1.0">
<id>https://sites.google.com/feeds/acl/site/domainName/siteName</id>
<updated>2009-12-03T22:01:05.963Z</updated>
<category scheme="http://schemas.google.com/g/2005#kind" term="http://schemas.google.com/acl/2007#accessRule"/>
<title>Acl</title>
<link rel="http://schemas.google.com/g/2005#feed" type="application/atom+xml"
href="https://sites.google.com/feeds/acl/site/domainName/siteName"/>
<link rel="http://schemas.google.com/g/2005#post" type="application/atom+xml"
href="https://sites.google.com/feeds/acl/site/domainName/siteName"/>
<link rel="self" type="application/atom+xml"
href="https://sites.google.com/feeds/acl/site/domainName/siteName"/>
<generator version="1" uri="http://sites.google.com">Google Sites</generator>
<openSearch:startIndex>1</openSearch:startIndex>
<entry>
<id>https://sites.google.com/feeds/acl/site/domainName/siteName/user%3AuserA%40gmail.com</id>
<updated>2009-12-03T22:01:05.963Z</updated>
<app:edited xmlns:app="http://www.w3.org/2007/app">2009-12-03T22:01:05.963Z</app:edited>
<category scheme="http://schemas.google.com/g/2005#kind" term="http://schemas.google.com/acl/2007#accessRule"/>
<link rel="self" type="application/atom+xml"
href="https://sites.google.com/feeds/acl/site/domainName/siteName/user%3AuserA%40google.com"/>
<link rel="edit" type="application/atom+xml"
href="https://sites.google.com/feeds/acl/site/domainName/siteName/user%3AuserA%40google.com"/>
<gAcl:scope type="user" value="userA@google.com"/>
<gAcl:role value="owner"/>
</entry>
<entry>
<id>https://sites.google.com/feeds/acl/site/domainName/siteName/user%3AuserB%40gmail.com</id>
<updated>2009-12-03T22:01:05.963Z</updated>
<app:edited xmlns:app="http://www.w3.org/2007/app">2009-12-03T22:01:05.963Z</app:edited>
<category scheme="http://schemas.google.com/g/2005#kind" term="http://schemas.google.com/acl/2007#accessRule"/>
<link rel="self" type="application/atom+xml"
href="https://sites.google.com/feeds/acl/site/domainName/siteName/user%3AuserB%40gmail.com"/>
<link rel="edit" type="application/atom+xml"
href="https://sites.google.com/feeds/acl/site/domainName/siteName/user%3AuserB%40gmail.com"/>
<gAcl:scope type="user" value="userB@gmail.com"/>
<gAcl:role value="writer"/>
</entry>
<entry>
<id>https://sites.google.com/feeds/acl/site/domainName/siteName/user%3AuserC%40gmail.com</id>
<updated>2009-12-03T22:01:05.963Z</updated>
<app:edited xmlns:app="http://www.w3.org/2007/app">2009-12-03T22:01:05.963Z</app:edited>
<category scheme="http://schemas.google.com/g/2005#kind" term="http://schemas.google.com/acl/2007#accessRule"/>
<link rel="self" type="application/atom+xml"
href="https://sites.google.com/feeds/acl/site/domainName/siteName/user%3AuserC%40gmail.com"/>
<link rel="edit" type="application/atom+xml"
href="https://sites.google.com/feeds/acl/site/domainName/siteName/user%3AuserC%40gmail.com"/>
<gAcl:scope type="user" value="userC@gmail.com"/>
<gAcl:role value="reader"/>
</entry>
...
</feed>
সাইট শেয়ার করা
ACL ফিড GET, POST ও PUT অনুরোধ গ্রহণ করে। ACL ফিডে নতুন ভূমিকা যোগ করতে, সাইটের ACL ফিডে POST অনুরোধ করুন।
মনে রাখবেন: ডোমেন কনফিগার করা থাকলে তবেই নির্দিষ্ট শেয়ারিং ACL সম্ভব হতে পারে যাতে এই ধরনের অনুমতি দেওয়া যায় (যেমন, G Suite ডোমেনের জন্য ডোমেনের বাইরে শেয়ার করার সুবিধা চালু করা থাকলে ইত্যাদি)।
এই উদাহরণে সাইটে একজন নতুন কোলাবরেটর (লেখক) যোগ করা হয়েছে:
POST /feeds/acl/site/domainName/siteName HTTP/1.1 Host: sites.google.com GData-Version: 1.4 Authorization: <your authorization header here> <entry xmlns="http://www.w3.org/2005/Atom" xmlns:gAcl='http://schemas.google.com/acl/2007'> <category scheme='http://schemas.google.com/g/2005#kind' term='http://schemas.google.com/acl/2007#accessRule'/> <gAcl:role value='writer'/> <gAcl:scope type='user' value='new_writer@example.com'/> </entry>
সফলভাবে যোগ করা হলে, একটি 201 Created এবং নতুন এন্ট্রি রিটার্ন করা হয়:
<entry> <id>https://sites.google.com/feeds/acl/site/domainName/siteName/user%3Anew_writer%40example.com</id> <updated>2009-12-03T22:01:05.963Z</updated> <app:edited xmlns:app="http://www.w3.org/2007/app">2009-12-03T22:01:05.963Z</app:edited> <category scheme="http://schemas.google.com/g/2005#kind" term="http://schemas.google.com/acl/2007#accessRule"/> <link rel="self" type="application/atom+xml" href="https://sites.google.com/feeds/acl/site/domainName/siteName/user%3Anew_writer%40example.com"/> <link rel="edit" type="application/atom+xml" href="https://sites.google.com/feeds/acl/site/domainName/siteName/user%3Anew_writer%40example.com"/> <gAcl:role value='writer'/> <gAcl:scope type='user' value='new_writer@example.com'/> </entry>
"আমন্ত্রণ" স্কোপের মাধ্যমে ব্যবহারকারীদের আমন্ত্রণ জানানো
Google অ্যাকাউন্ট নেই এমন ব্যবহারকারীদের আপনি যোগ করলে, API একটি URL রিটার্ন করে যা আপনাকে অবশ্যই সেইসব ব্যবহারকারীদের দিতে হবে যাদের আপনি আমন্ত্রণ জানাতে চান। URL-এ ক্লিক করার পরে, আগে থেকে থাকা অ্যাকাউন্টে সাইন-ইন করে অথবা নতুন অ্যাকাউন্ট তৈরি করে তারা সাইট অ্যাক্সেস করতে পারবেন।
সফল আমন্ত্রণ একটি 201 Created এবং একটি নতুন এন্ট্রি রিটার্ন করে যার মধ্যে সেই URL থাকে যা আপনাকে ব্যবহারকারীকে দিতে হবে:
<entry> <id>https://sites.google.com/feeds/acl/site/domainName/siteName/user%3Anew_invite%40example.com</id> <updated>2009-12-03T22:01:05.963Z</updated> <app:edited xmlns:app="http://www.w3.org/2007/app">2009-12-03T22:01:05.963Z</app:edited> <category scheme="http://schemas.google.com/g/2005#kind" term="http://schemas.google.com/acl/2007#accessRule"/> <link rel="http://schemas.google.com/sites/2008#invite" type="text/html"href="domainName/siteName?invite=inviteToken"/> <link rel="self" type="application/atom+xml" href="https://sites.google.com/feeds/acl/site/domainName/siteName/user%3Anew_invite%40example.com"/> <link rel="edit" type="application/atom+xml" href="https://sites.google.com/feeds/acl/site/domainName/siteName/user%3Anew_invite%40example.com"/> <gAcl:role value='writer'/> <gAcl:scope type='invite' value='new_invite%40example.com'/> </entry>
গ্রুপ ও ডোমেন লেভেলে শেয়ার করা
কোনও সাইট একজন ব্যবহারকারীর সাথে শেয়ার করার মতো, আপনি কোনও Google গ্রুপ বা G Suite ডোমেন জুড়ে
সাইট শেয়ার করতে পারবেন। প্রয়োজনীয় scope ভ্যালু নিচে তালিকাভুক্ত করা হয়েছে।
গ্রুপ ইমেল আইডিতে শেয়ার করা:
<gAcl:scope type="group" value="group@example.com"/>
সম্পূর্ণ ডোমেনে শেয়ার করা:
<gAcl:scope type="domain" value="example.com"/>
ডোমেন লেভেলে শেয়ার করার সুবিধা শুধুমাত্র G Suite ডোমেনের ক্ষেত্রে এবং শুধুমাত্র সেই ডোমেনের ক্ষেত্রে কাজ করে যেখানে সাইট হোস্ট করা হয়। যেমন, http://sites.google.com/a/domain1.com/siteA শুধুমাত্র domain1.com-এর সাথে সম্পূর্ণ সাইট শেয়ার করতে পারবে, domain2.com-এর সাথে নয়। যেসব সাইট G Suite ডোমেনে হোস্ট করা হয় না (যেমন, http://sites.google.com/site/siteB) সেগুলি ডোমেনকে আমন্ত্রণ জানাতে পারে না।
শেয়ারিং সংক্রান্ত অনুমতি পরিবর্তন করা
ACL এন্ট্রি আপডেট করতে, প্রয়োজন অনুযায়ী এন্ট্রি পরিবর্তন করুন এবং এন্ট্রির edit লিঙ্কে HTTP PUT অনুরোধ ইস্যু করুন, যা হল
একটি <link> এলিমেন্ট, যার 'rel' অ্যাট্রিবিউট 'এডিট করুন' হিসেবে সেট করা আছে। আগের উদাহরণের জন্য, সেই লিঙ্কটি হল:
<link rel='edit' type='application/atom+xml'
href='https://sites.google.com/feeds/acl/site/domainName/siteName/user%3Anew_writer%40example.com'/>নিচের স্নিপেটটি new_writer@gmail.com-এর ভূমিকা পরিবর্তন করে 'রিডার' করে দেয়:
PUT /feeds/acl/site/domainName/siteName/user%3Anew_writer%40example.com HTTP/1.1 Host: sites.google.com GData-Version: 1.4 Authorization: <your authorization header here> <entry xmlns="http://www.w3.org/2005/Atom" xmlns:gAcl='http://schemas.google.com/acl/2007'> <category scheme='http://schemas.google.com/g/2005#kind' term='http://schemas.google.com/acl/2007#accessRule'/> <gAcl:role value='reader'/> <gAcl:scope type='user' value='new_writer@gmail.com'/> </entry>
শেয়ার করার অনুমতি সরানো
এই ব্যবহারকারীর জন্য অনুমতি সরিয়ে দিতে, PUT অনুরোধের জন্য ব্যবহৃত একই edit লিঙ্কে একটি DELETE অনুরোধ ইস্যু করুন:
DELETE /feeds/acl/site/domainName/siteName/user%3Anew_writer%40example.com HTTP/1.1 Host: sites.google.com GData-Version: 1.4 Authorization: <your authorization header here>
সার্ভার 200 OK দিয়ে উত্তর দেবে।
বিশেষ বিষয়
ফিড বা এন্ট্রি আবার ফিরিয়ে আনা
আপনি আগে যে ফিড বা এন্ট্রি রিট্রিভ করেছেন সেটি আবার রিট্রিভ করতে চাইলে, সার্ভারকে বলুন যে আপনি শেষবার রিট্রিভ করার পর সেটি পরিবর্তিত হয়ে থাকলে তবেই যেন তালিকা বা এন্ট্রি পাঠানো হয়। এর মাধ্যমে আপনি দক্ষতা বাড়াতে পারবেন।
এই ধরনের কন্ডিশনাল রিট্রিভালের জন্য, HTTP GET অনুরোধ পাঠান যাতে HTTP
If-None-Match হেডার থাকে। হেডারে, তালিকা বা এন্ট্রির ETag উল্লেখ করুন, যা আপনি
<feed> এলিমেন্ট বা <entry> এলিমেন্টের gd:etag অ্যাট্রিবিউটে পাবেন।
সাইট ফিড ব্যবহার করে একটি উদাহরণ:
GET /feeds/site/domainName/myOtherTestSite/ GData-Version: 1.4 If-None-Match: W/"Ck8GQXk7fil7ImA9WxNSFk0."
সার্ভার এই অনুরোধটি পেলে, সেটি চেক করে দেখে যে আপনার অনুরোধ করা আইটেমের ETag-এর সাথে
আপনার উল্লেখ করা ETag একই কিনা। ETag মিলে গেলে, আইটেমটি পরিবর্তন করা হয়নি এবং সার্ভার
HTTP 304 Not Modified স্ট্যাটাস কোড বা HTTP 412 Precodition Failed স্ট্যাটাস কোড রিটার্ন করে। এই দুটি
স্ট্যাটাস কোডই ইঙ্গিত করে যে আপনি আগেই যে আইটেমটি পেয়েছেন সেটি আপ-টু-ডেট।
ETag না মিললে, আপনি শেষবার অনুরোধ করার পর আইটেমটি পরিবর্তন করা হয়েছে এবং সার্ভার আইটেমটি রিটার্ন করে।
ETags সম্পর্কে আরও তথ্য পেতে, Google Data API রেফারেন্স গাইড দেখুন।
ব্যাচ প্রসেসিং
ব্যাচ অনুরোধ আপনার ক্লায়েন্টকে প্রতিটি অপারেশন আলাদা আলাদাভাবে জমা দেওয়ার পরিবর্তে একটি অনুরোধে একাধিক অপারেশন এক্সিকিউট করার ক্ষমতা দেয়।
সার্ভার, অনুরোধ করা পরিবর্তনগুলির মধ্যে যতগুলি সম্ভব পারফর্ম করবে এবং স্ট্যাটাস সংক্রান্ত তথ্য রিটার্ন করবে যা আপনি প্রতিটি অপারেশনের সাফল্য বা ব্যর্থতা মূল্যায়ন করতে ব্যবহার করতে পারবেন। Google Data API-তে ব্যাচ প্রসেসিং সম্পর্কে আরও বিস্তারিত জানতে, Google Data API-এর মাধ্যমে ব্যাচ প্রসেসিং দেখুন
ইনসার্ট অপারেশন ছাড়া ব্যাচ ফিডের প্রতিটি অপারেশনে একটি <id> এলিমেন্ট থাকে।
কন্টেন্ট ফিড আপডেট, মুছে ফেলা বা কোয়েরি করার সময় আপনি সাধারণত যে অনুরোধ URL ব্যবহার করেন, এই এলিমেন্টটি একই।
যেমন, আপনি যদি কোনও এডিট আপডেট করে থাকেন, তাহলে <id>-কে সেই এন্ট্রির edit লিঙ্কে সেট করুন যেটির ব্যাপারে প্রশ্ন করা হয়েছে।
টার্গেট এন্ট্রি শনাক্ত করতে এটি ব্যবহার করা হয়। নতুন এন্ট্রিতে <id> এলিমেন্ট থাকে না কারণ সেগুলি
এখনও তৈরি করা হয়নি। এর পরিবর্তে, আপনি <batch:id>-এ একটি স্ট্রিং ভ্যালু নির্ধারণ করতে পারেন, যা
সার্ভারের উত্তরে ফেরত দেওয়া হবে এবং সংশ্লিষ্ট এন্ট্রি খুঁজে দেখার জন্য ব্যবহার করা হবে।
ব্যাচ অনুরোধ করতে, ব্যাচ ফিড তৈরি করুন এবং ফিডের ব্যাচ লিঙ্কে HTTP POST পাঠান:
<link rel="http://schemas.google.com/g/2005#batch" type="application/atom+xml"
href="https://sites.google.com/feeds/content/site/siteName/batch"/>
কীভাবে কোনও ওয়েবপেজ এন্ট্রি কোয়েরি, ইনসার্ট, আপডেট ও ডিলিট করতে হয় তা নিচের উদাহরণে দেখানো হল:
POST /feeds/content/site/siteName/batch HTTP/1.1 Host: sites.google.com Accept: */* If-Match: * GData-Version: 1.4 Authorization: <your authorization header here> <feed xmlns="http://www.w3.org/2005/Atom" xmlns:sites="http://schemas.google.com/sites/2008" xmlns:gd="http://schemas.google.com/g/2005" xmlns:batch='http://schemas.google.com/gdata/batch'> <entry> <id>https://sites.google.com/feeds/content/site/siteName/ENTRY_ID1</id> <batch:operation type="query"/> </entry> <entry> <batch:id>1</batch:id> <batch:operation type='insert'/> <category scheme="http://schemas.google.com/g/2005#kind" term="http://schemas.google.com/sites/2008#webpage" label="webpage"/> <title>New Webpage1</title> <content type="xhtml"> <div xmlns="http://www.w3.org/1999/xhtml">HTML body goes here</div> </content> </entry> <entry gd:etag=""YDgpeyI.""> <id>https://sites.google.com/feeds/content/site/siteName/ENTRY_ID2</id> <batch:operation type='update'/> <category scheme="http://schemas.google.com/g/2005#kind" term="http://schemas.google.com/sites/2008#webpage" label="webpage"/> <title>Updated Title for Webpage2</title> ... <batch:operaation type="update"/> </entry> <entry gd:etag=""YassseyI.""> <id>https://sites.google.com/feeds/content/site/siteName/ENTRY_ID3</id> <batch:operation type='delete'/> </entry> </feed>
ফেরানো ফিডে প্রতিটি অপারেশনের জন্য একটি করে ফলাফল এন্ট্রি থাকবে:
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/"
xmlns:sites="http://schemas.google.com/sites/2008" xmlns:gs="http://schemas.google.com/spreadsheets/2006"
xmlns:dc="http://purl.org/dc/terms" xmlns:batch="http://schemas.google.com/gdata/batch"
xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0">
<id>https://sites.google.com/feeds/content/site/siteName/ENTRY_ID1</id>
<updated>2009-11-10T22:44:08.369Z</updated>
<title>Batch Feed</title>
<entry gd:etag=""YDgpsdfeyI."">
<id>https://sites.google.com/feeds/content/site/siteName/ENTRY_ID1</id>
<published>2009-08-31T04:42:45.251Z</published>
<updated>2009-10-25T22:46:13.729Z</updated>
<app:edited xmlns:app="http://www.w3.org/2007/app">2009-10-25T22:46:13.671Z</app:edited>
<category scheme="http://schemas.google.com/g/2005#kind"
term="http://schemas.google.com/sites/2008#webpage" label="webpage"/>
<title>Page Title</title>
...
<batch:status code="200" reason="Success"/>
<batch:operation type="query"/>
</entry>
<entry gd:etag=""YDsseyI."">
<id>https://sites.google.com/feeds/content/site/siteName/ENTRY_ID4</id>
<published>2009-11-10T22:44:08.531Z</published>
<updated>2009-11-10T22:44:08.560Z</updated>
<app:edited xmlns:app="http://www.w3.org/2007/app">2009-11-10T22:44:08.531Z</app:edited>
<category scheme="http://schemas.google.com/g/2005#kind" term="http://schemas.google.com/sites/2008#webpage" label="webpage"/>
<title>New Webpage1</title>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<table cellspacing="0" class="sites-layout-name-one-column sites-layout-hbox">
<tbody>
<tr>
<td class="sites-layout-tile sites-tile-name-content-1">
<div>HTML body goes here</div>
</td>
</tr>
</tbody>
</table>
</div>
</content>
...
<batch:id>1</batch:id>
<batch:status code="201" reason="Created"/>
<batch:operation type="insert"/>
</entry>
<entry gd:etag=""YDkpeyI."">
<id>https://sites.google.com/feeds/content/site/siteName/ENTRY_ID2</id>
<updated>2009-11-10T22:44:09.296Z</updated>
<title>Updated Title for Webpage2</title>
...
<sites:pageName>updated-title-for-webpage2</sites:pageName>
<sites:revision>5</sites:revision>
<batch:status code="200" reason="Success"/>
<batch:operation type="update"/>
</entry>
<entry>
<id>https://sites.google.com/feeds/content/site/siteName/ENTRY_ID3</id>
<title>Deleted</title>
<content>Deleted</content>
<batch:status code="200" reason="Success"/>
<batch:operation type="delete"/>
</entry>
</feed>