דוגמה פשוטה לאחזור פידים של JSON מ-Blogger Data API
קל לארגן דפים בעזרת אוספים
אפשר לשמור ולסווג תוכן על סמך ההעדפות שלך.
מבוא
בדוגמה זו מוצגת רשימה של פוסטים עדכניים מבלוג שמתארח ב-Blogger בגרסת בטא, באמצעות פורמט פלט JSON שסופק על ידי Blogger Data API. כך אפשר להריץ שאילתה על פיד ציבורי של בלוג, ולהחזיר את הערכים שהתקבלו כאובייקטים מסוג JSON. כדי להשתמש בפיד ה-JSON החדש,
יש ליצור רכיב סקריפט שהערך של src
שלו הוא
https://blogname.blogspot.com/feeds/posts/default?alt=json-in-script&callback=myFunc
כאשר blogname
הוא הבלוג שרוצים לאחזר, ו-myFunc
הוא השם של פונקציית הקריאה החוזרת שעוברת באובייקט JSON.
למידע נוסף על תמיכה בפלט JSON עבור Google Data APIs, אפשר לקרוא את מסמכי התמיכה בנושא פלט JSON.
אלא אם צוין אחרת, התוכן של דף זה הוא ברישיון Creative Commons Attribution 4.0 ודוגמאות הקוד הן ברישיון Apache 2.0. לפרטים, ניתן לעיין במדיניות האתר Google Developers. Java הוא סימן מסחרי רשום של חברת Oracle ו/או של השותפים העצמאיים שלה.
עדכון אחרון: 2023-03-01 (שעון UTC).
[null,null,["עדכון אחרון: 2023-03-01 (שעון UTC)."],[],[],null,["# Simple example of retrieving JSON feeds from Blogger Data API\n\n### Introduction\n\nThis sample demonstrates displaying a list of recent posts from a blog hosted on Blogger Beta\nusing the JSON output format provided by the Blogger Data API. This allows you to query a blog's\npublic feed and get the resulting entries returned as JSON objects. To use the new JSON feed,\ncreate a script element whose `src` value is\n\u003e `https://`**blogname** `.blogspot.com/feeds/posts/default?alt=json-in-script&callback=`**myFunc**\n\nwhere **`blogname`** is the blog you want to retrieve, and\n**`myFunc`** is the name of your callback function that is passed the JSON object.\nFor more information on JSON output support for Google Data APIs please see our\n[JSON output support documentation](/gdata/json).\n\n### Demo with data from googlemapsapi.blogspot.com"]]