mirror of
https://github.com/google/styleguide.git
synced 2024-03-22 13:11:43 +08:00
2539 lines
88 KiB
HTML
2539 lines
88 KiB
HTML
|
<HTML xmlns:fn="http://www.w3.org/2005/xpath-functions" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:dcq="http://purl.org/dc/qualifiers/1.0/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
|
||
|
<HEAD>
|
||
|
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||
|
<TITLE>Google JSON Style Guide</TITLE>
|
||
|
<META content="text/html; charset=utf-8" http-equiv="Content-Type">
|
||
|
<LINK rel="shortcut icon" type="image/x-icon" HREF="http://www.google.com/favicon.ico">
|
||
|
<LINK rel="stylesheet" type="text/css" HREF="styleguide.css">
|
||
|
<SCRIPT type="text/javascript" language="javascript">
|
||
|
|
||
|
function ShowHideByName(bodyName, buttonName) {
|
||
|
var bodyElements;
|
||
|
if (document.getElementsByName) {
|
||
|
bodyElements = document.getElementsByName(bodyName);
|
||
|
} else {
|
||
|
bodyElements = [document.getElementById(bodyName)];
|
||
|
}
|
||
|
if (bodyElements.length != 1) {
|
||
|
alert("ShowHideByName() got the wrong number of bodyElements: " + bodyElements.length);
|
||
|
} else {
|
||
|
var bodyElement = bodyElements[0];
|
||
|
var buttonElement;
|
||
|
if (document.getElementsByName) {
|
||
|
var buttonElements = document.getElementsByName(buttonName);
|
||
|
buttonElement = buttonElements[0];
|
||
|
} else {
|
||
|
buttonElement = document.getElementById(buttonName);
|
||
|
}
|
||
|
if (bodyElement.style.display == "none" || bodyElement.style.display == "") {
|
||
|
bodyElement.style.display = "inline";
|
||
|
buttonElement.innerHTML = '▽';
|
||
|
} else {
|
||
|
bodyElement.style.display = "none";
|
||
|
buttonElement.innerHTML = '▶';
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
function ShowHideAll() {
|
||
|
var allButton;
|
||
|
if (document.getElementsByName) {
|
||
|
var allButtons = document.getElementsByName("show_hide_all_button");
|
||
|
allButton = allButtons[0];
|
||
|
} else {
|
||
|
allButton = document.getElementById("show_hide_all_button");
|
||
|
}
|
||
|
if (allButton.innerHTML == '▽') {
|
||
|
allButton.innerHTML = '▶';
|
||
|
SetHiddenState(document.getElementsByTagName("body")[0].childNodes, "none", '▶');
|
||
|
} else {
|
||
|
allButton.innerHTML = '▽';
|
||
|
SetHiddenState(document.getElementsByTagName("body")[0].childNodes, "inline", '▽');
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// Recursively sets state of all children
|
||
|
// of a particular node.
|
||
|
function SetHiddenState(root, newState, newButton) {
|
||
|
for (var i = 0; i != root.length; i++) {
|
||
|
SetHiddenState(root[i].childNodes, newState, newButton);
|
||
|
if (root[i].className == 'showhide_button') {
|
||
|
root[i].innerHTML = newButton;
|
||
|
}
|
||
|
if (root[i].className == 'stylepoint_body') {
|
||
|
root[i].style.display = newState;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
window.onload = function() {
|
||
|
// if the URL contains "?showall=y", expand the details of all children
|
||
|
{
|
||
|
var showHideAllRegex = new RegExp("[\\?&](showall)=([^&#]*)");
|
||
|
var showHideAllValue = showHideAllRegex.exec(window.location.href);
|
||
|
if (showHideAllValue != null) {
|
||
|
if (showHideAllValue[2] == "y") {
|
||
|
SetHiddenState(document.getElementsByTagName("body")[0].childNodes, "inline", '▽');
|
||
|
} else {
|
||
|
SetHiddenState(document.getElementsByTagName("body")[0].childNodes, "none", '▶');
|
||
|
}
|
||
|
}
|
||
|
var showOneRegex = new RegExp("[\\?&](showone)=([^&#]*)");
|
||
|
var showOneValue = showOneRegex.exec(window.location.href);
|
||
|
if (showOneValue != null) {
|
||
|
var body_name = showOneValue[2] + '__body';
|
||
|
var button_name = showOneValue[2] + '__button';
|
||
|
ShowHideByName(body_name, button_name);
|
||
|
}
|
||
|
|
||
|
}
|
||
|
}
|
||
|
</SCRIPT>
|
||
|
</HEAD>
|
||
|
<BODY>
|
||
|
<H1>Google JSON Style Guide</H1>
|
||
|
|
||
|
|
||
|
<p align="right">
|
||
|
Revision 0.9
|
||
|
</p>
|
||
|
|
||
|
|
||
|
<address>
|
||
|
|
||
|
</address>
|
||
|
|
||
|
|
||
|
<DIV style="margin-left: 50%; font-size: 75%;">
|
||
|
<P>
|
||
|
Each style point has a summary for which additional information is available
|
||
|
by toggling the accompanying arrow button that looks this way:
|
||
|
<SPAN style="margin-left: 0;" class="showhide_button">▶</SPAN>.
|
||
|
You may toggle all summaries with the big arrow button:
|
||
|
</P>
|
||
|
<DIV style=" font-size: larger; margin-left: +2em;">
|
||
|
<SPAN style="font-size: 180%;" class="showhide_button" onclick="javascript:ShowHideAll()" name="show_hide_all_button" id="show_hide_all_button">▶</SPAN>
|
||
|
Toggle all summaries
|
||
|
</DIV>
|
||
|
</DIV>
|
||
|
<DIV class="toc">
|
||
|
<DIV class="toc_title">Table of Contents</DIV>
|
||
|
<TABLE>
|
||
|
<TR valign="top" class="">
|
||
|
<TD>
|
||
|
<DIV class="toc_category">
|
||
|
<A href="#General_Guidelines">General Guidelines</A>
|
||
|
</DIV>
|
||
|
</TD><TD>
|
||
|
<DIV class="toc_stylepoint">
|
||
|
<SPAN style="padding-right: 1em; white-space:nowrap;" class=""><A href="#Comments">Comments</A></SPAN> <SPAN style="padding-right: 1em; white-space:nowrap;" class=""><A href="#Double_Quotes">Double Quotes</A></SPAN> <SPAN style="padding-right: 1em; white-space:nowrap;" class=""><A href="#Flattened_data_vs_Structured_Hierarchy">Flattened data vs Structured Hierarchy</A></SPAN>
|
||
|
</DIV>
|
||
|
</TD>
|
||
|
</TR>
|
||
|
<TR valign="top" class="">
|
||
|
<TD>
|
||
|
<DIV class="toc_category">
|
||
|
<A href="#Property_Name_Guidelines">Property Name Guidelines</A>
|
||
|
</DIV>
|
||
|
</TD><TD>
|
||
|
<DIV class="toc_stylepoint">
|
||
|
<SPAN style="padding-right: 1em; white-space:nowrap;" class=""><A href="#Property_Name_Format">Property Name Format</A></SPAN> <SPAN style="padding-right: 1em; white-space:nowrap;" class=""><A href="#Key_Names_in_JSON_Maps">Key Names in JSON Maps</A></SPAN> <SPAN style="padding-right: 1em; white-space:nowrap;" class=""><A href="#Reserved_Property_Names">Reserved Property Names</A></SPAN> <SPAN style="padding-right: 1em; white-space:nowrap;" class=""><A href="#Singular_vs_Plural_Property_Names">Singular vs Plural Property Names</A></SPAN> <SPAN style="padding-right: 1em; white-space:nowrap;" class=""><A href="#Naming_Conflicts">Naming Conflicts</A></SPAN>
|
||
|
</DIV>
|
||
|
</TD>
|
||
|
</TR>
|
||
|
<TR valign="top" class="">
|
||
|
<TD>
|
||
|
<DIV class="toc_category">
|
||
|
<A href="#Property_Value_Guidelines">Property Value Guidelines</A>
|
||
|
</DIV>
|
||
|
</TD><TD>
|
||
|
<DIV class="toc_stylepoint">
|
||
|
<SPAN style="padding-right: 1em; white-space:nowrap;" class=""><A href="#Property_Value_Format">Property Value Format</A></SPAN> <SPAN style="padding-right: 1em; white-space:nowrap;" class=""><A href="#Empty/Null_Property_Values">Empty/Null Property Values</A></SPAN> <SPAN style="padding-right: 1em; white-space:nowrap;" class=""><A href="#Enum_Values">Enum Values</A></SPAN>
|
||
|
</DIV>
|
||
|
</TD>
|
||
|
</TR>
|
||
|
<TR valign="top" class="">
|
||
|
<TD>
|
||
|
<DIV class="toc_category">
|
||
|
<A href="#Property_Value_Data_Types">Property Value Data Types</A>
|
||
|
</DIV>
|
||
|
</TD><TD>
|
||
|
<DIV class="toc_stylepoint">
|
||
|
<SPAN style="padding-right: 1em; white-space:nowrap;" class=""><A href="#Date_Property_Values">Date Property Values</A></SPAN> <SPAN style="padding-right: 1em; white-space:nowrap;" class=""><A href="#Time_Duration_Property_Values">Time Duration Property Values</A></SPAN> <SPAN style="padding-right: 1em; white-space:nowrap;" class=""><A href="#Latitude/Longitude_Property_Values">Latitude/Longitude Property Values</A></SPAN>
|
||
|
</DIV>
|
||
|
</TD>
|
||
|
</TR>
|
||
|
<TR valign="top" class="">
|
||
|
<TD>
|
||
|
<DIV class="toc_category">
|
||
|
<A href="#JSON_Structure_&_Reserved_Property_Names">JSON Structure & Reserved Property Names</A>
|
||
|
</DIV>
|
||
|
</TD><TD>
|
||
|
<DIV class="toc_stylepoint"></DIV>
|
||
|
</TD>
|
||
|
</TR>
|
||
|
<TR valign="top" class="">
|
||
|
<TD>
|
||
|
<DIV class="toc_category">
|
||
|
<A href="#Top-Level_Reserved_Property_Names">Top-Level Reserved Property Names</A>
|
||
|
</DIV>
|
||
|
</TD><TD>
|
||
|
<DIV class="toc_stylepoint">
|
||
|
<SPAN style="padding-right: 1em; white-space:nowrap;" class=""><A href="#apiVersion">apiVersion</A></SPAN> <SPAN style="padding-right: 1em; white-space:nowrap;" class=""><A href="#context">context</A></SPAN> <SPAN style="padding-right: 1em; white-space:nowrap;" class=""><A href="#id">id</A></SPAN> <SPAN style="padding-right: 1em; white-space:nowrap;" class=""><A href="#method">method</A></SPAN> <SPAN style="padding-right: 1em; white-space:nowrap;" class=""><A href="#params">params</A></SPAN> <SPAN style="padding-right: 1em; white-space:nowrap;" class=""><A href="#data">data</A></SPAN> <SPAN style="padding-right: 1em; white-space:nowrap;" class=""><A href="#error">error</A></SPAN>
|
||
|
</DIV>
|
||
|
</TD>
|
||
|
</TR>
|
||
|
<TR valign="top" class="">
|
||
|
<TD>
|
||
|
<DIV class="toc_category">
|
||
|
<A href="#Reserved_Property_Names_in_the_data_object">Reserved Property Names in the data object</A>
|
||
|
</DIV>
|
||
|
</TD><TD>
|
||
|
<DIV class="toc_stylepoint">
|
||
|
<SPAN style="padding-right: 1em; white-space:nowrap;" class=""><A href="#data.kind">data.kind</A></SPAN> <SPAN style="padding-right: 1em; white-space:nowrap;" class=""><A href="#data.fields">data.fields</A></SPAN> <SPAN style="padding-right: 1em; white-space:nowrap;" class=""><A href="#data.etag">data.etag</A></SPAN> <SPAN style="padding-right: 1em; white-space:nowrap;" class=""><A href="#data.id">data.id</A></SPAN> <SPAN style="padding-right: 1em; white-space:nowrap;" class=""><A href="#data.lang">data.lang</A></SPAN> <SPAN style="padding-right: 1em; white-space:nowrap;" class=""><A href="#data.updated">data.updated</A></SPAN> <SPAN style="padding-right: 1em; white-space:nowrap;" class=""><A href="#data.deleted">data.deleted</A></SPAN> <SPAN style="padding-right: 1em; white-space:nowrap;" class=""><A href="#data.items">data.items</A></SPAN>
|
||
|
</DIV>
|
||
|
</TD>
|
||
|
</TR>
|
||
|
<TR valign="top" class="">
|
||
|
<TD>
|
||
|
<DIV class="toc_category">
|
||
|
<A href="#Reserved_Property_Names_for_Paging">Reserved Property Names for Paging</A>
|
||
|
</DIV>
|
||
|
</TD><TD>
|
||
|
<DIV class="toc_stylepoint">
|
||
|
<SPAN style="padding-right: 1em; white-space:nowrap;" class=""><A href="#data.currentItemCount">data.currentItemCount</A></SPAN> <SPAN style="padding-right: 1em; white-space:nowrap;" class=""><A href="#data.itemsPerPage">data.itemsPerPage</A></SPAN> <SPAN style="padding-right: 1em; white-space:nowrap;" class=""><A href="#data.startIndex">data.startIndex</A></SPAN> <SPAN style="padding-right: 1em; white-space:nowrap;" class=""><A href="#data.totalItems">data.totalItems</A></SPAN> <SPAN style="padding-right: 1em; white-space:nowrap;" class=""><A href="#data.pagingLinkTemplate">data.pagingLinkTemplate</A></SPAN> <SPAN style="padding-right: 1em; white-space:nowrap;" class=""><A href="#data.pageIndex">data.pageIndex</A></SPAN> <SPAN style="padding-right: 1em; white-space:nowrap;" class=""><A href="#data.totalPages">data.totalPages</A></SPAN>
|
||
|
</DIV>
|
||
|
</TD>
|
||
|
</TR>
|
||
|
<TR valign="top" class="">
|
||
|
<TD>
|
||
|
<DIV class="toc_category">
|
||
|
<A href="#Reserved_Property_Names_for_Links">Reserved Property Names for Links</A>
|
||
|
</DIV>
|
||
|
</TD><TD>
|
||
|
<DIV class="toc_stylepoint">
|
||
|
<SPAN style="padding-right: 1em; white-space:nowrap;" class=""><A href="#data.self_/_data.selfLink">data.self / data.selfLink</A></SPAN> <SPAN style="padding-right: 1em; white-space:nowrap;" class=""><A href="#data.edit_/_data.editLink">data.edit / data.editLink</A></SPAN> <SPAN style="padding-right: 1em; white-space:nowrap;" class=""><A href="#data.next_/_data.nextLink">data.next / data.nextLink</A></SPAN> <SPAN style="padding-right: 1em; white-space:nowrap;" class=""><A href="#data.previous_/_data.previousLink">data.previous / data.previousLink</A></SPAN>
|
||
|
</DIV>
|
||
|
</TD>
|
||
|
</TR>
|
||
|
<TR valign="top" class="">
|
||
|
<TD>
|
||
|
<DIV class="toc_category">
|
||
|
<A href="#Reserved_Property_Names_in_the_error_object">Reserved Property Names in the error object</A>
|
||
|
</DIV>
|
||
|
</TD><TD>
|
||
|
<DIV class="toc_stylepoint">
|
||
|
<SPAN style="padding-right: 1em; white-space:nowrap;" class=""><A href="#error.code">error.code</A></SPAN> <SPAN style="padding-right: 1em; white-space:nowrap;" class=""><A href="#error.message">error.message</A></SPAN> <SPAN style="padding-right: 1em; white-space:nowrap;" class=""><A href="#error.errors">error.errors</A></SPAN> <SPAN style="padding-right: 1em; white-space:nowrap;" class=""><A href="#error.errors[].domain">error.errors[].domain</A></SPAN> <SPAN style="padding-right: 1em; white-space:nowrap;" class=""><A href="#error.errors[].reason">error.errors[].reason</A></SPAN> <SPAN style="padding-right: 1em; white-space:nowrap;" class=""><A href="#error.errors[].message">error.errors[].message</A></SPAN> <SPAN style="padding-right: 1em; white-space:nowrap;" class=""><A href="#error.errors[].location">error.errors[].location</A></SPAN> <SPAN style="padding-right: 1em; white-space:nowrap;" class=""><A href="#error.errors[].locationType">error.errors[].locationType</A></SPAN> <SPAN style="padding-right: 1em; white-space:nowrap;" class=""><A href="#error.errors[].extendedHelp">error.errors[].extendedHelp</A></SPAN> <SPAN style="padding-right: 1em; white-space:nowrap;" class=""><A href="#error.errors[].sendReport">error.errors[].sendReport</A></SPAN>
|
||
|
</DIV>
|
||
|
</TD>
|
||
|
</TR>
|
||
|
<TR valign="top" class="">
|
||
|
<TD>
|
||
|
<DIV class="toc_category">
|
||
|
<A href="#Property_Ordering">Property Ordering</A>
|
||
|
</DIV>
|
||
|
</TD><TD>
|
||
|
<DIV class="toc_stylepoint">
|
||
|
<SPAN style="padding-right: 1em; white-space:nowrap;" class=""><A href="#Kind_Property">Kind Property</A></SPAN> <SPAN style="padding-right: 1em; white-space:nowrap;" class=""><A href="#Items_Property">Items Property</A></SPAN> <SPAN style="padding-right: 1em; white-space:nowrap;" class=""><A href="#Property_Ordering_Example">Property Ordering Example</A></SPAN>
|
||
|
</DIV>
|
||
|
</TD>
|
||
|
</TR>
|
||
|
<TR valign="top" class="">
|
||
|
<TD>
|
||
|
<DIV class="toc_category">
|
||
|
<A href="#Examples">Examples</A>
|
||
|
</DIV>
|
||
|
</TD><TD>
|
||
|
<DIV class="toc_stylepoint">
|
||
|
<SPAN style="padding-right: 1em; white-space:nowrap;" class=""><A href="#YouTube_JSON_API">YouTube JSON API</A></SPAN> <SPAN style="padding-right: 1em; white-space:nowrap;" class=""><A href="#Paging_Example">Paging Example</A></SPAN>
|
||
|
</DIV>
|
||
|
</TD>
|
||
|
</TR>
|
||
|
<TR valign="top" class="">
|
||
|
<TD>
|
||
|
<DIV class="toc_category">
|
||
|
<A href="#Appendix">Appendix</A>
|
||
|
</DIV>
|
||
|
</TD><TD>
|
||
|
<DIV class="toc_stylepoint">
|
||
|
<SPAN style="padding-right: 1em; white-space:nowrap;" class=""><A href="#Appendix_A:_Reserved_JavaScript_Words">Appendix A: Reserved JavaScript Words</A></SPAN>
|
||
|
</DIV>
|
||
|
</TD>
|
||
|
</TR>
|
||
|
</TABLE>
|
||
|
</DIV>
|
||
|
<H2>Overview</H2>
|
||
|
|
||
|
<DIV class="">
|
||
|
<H2 name="Important_Note" id="Important_Note">Important Note</H2>
|
||
|
|
||
|
<DIV class="">
|
||
|
<H3>
|
||
|
<A name="Display_Hidden_Details_in_this_Guide" id="Display_Hidden_Details_in_this_Guide">Display Hidden Details in this Guide</A>
|
||
|
</H3>
|
||
|
<SPAN class="showhide_button" onclick="javascript:ShowHideByName('Display_Hidden_Details_in_this_Guide__body','Display_Hidden_Details_in_this_Guide__button')" name="Display_Hidden_Details_in_this_Guide__button" id="Display_Hidden_Details_in_this_Guide__button">▶</SPAN>
|
||
|
|
||
|
<DIV style="display:inline;" class="">
|
||
|
This style guide contains many details that are initially hidden from view. They are marked by the triangle icon, which you see here on your left. Click it now. You should see "Hooray" appear below.
|
||
|
</DIV>
|
||
|
|
||
|
<DIV class="">
|
||
|
<DIV class="stylepoint_body" name="Display_Hidden_Details_in_this_Guide__body" id="Display_Hidden_Details_in_this_Guide__body" style="display: none">
|
||
|
<SPAN class="link_button"><A href="?showone=Display_Hidden_Details_in_this_Guide#Display_Hidden_Details_in_this_Guide">
|
||
|
link
|
||
|
</A></SPAN>
|
||
|
|
||
|
<p>Hooray! Now you know you can expand points to get more details. Alternatively, there's an "expand all" at the top of this document.</p>
|
||
|
|
||
|
</DIV>
|
||
|
</DIV>
|
||
|
|
||
|
</DIV>
|
||
|
|
||
|
</DIV>
|
||
|
|
||
|
<DIV class="">
|
||
|
<H2 name="Introduction" id="Introduction">Introduction</H2>
|
||
|
|
||
|
<p>This style guide documents guidelines and recommendations for building JSON APIs at Google. In general, JSON APIs should follow the spec found at <a href="http://www.json.org">JSON.org</a>. This style guide clarifies and standardizes specific cases so that JSON APIs from Google have a standard look and feel. These guidelines are applicable to JSON requests and responses in both RPC-based and REST-based APIs.</p>
|
||
|
|
||
|
</DIV>
|
||
|
|
||
|
<DIV class="">
|
||
|
<H2 name="Definitions" id="Definitions">Definitions</H2>
|
||
|
|
||
|
<p>For the purposes of this style guide, we define the following terms:</p>
|
||
|
<ul>
|
||
|
<li>property - a name/value pair inside a JSON object.</li>
|
||
|
<li>property name - the name (or key) portion of the property.</li>
|
||
|
<li>property value - the value portion of the property:</li>
|
||
|
</ul>
|
||
|
|
||
|
<DIV class="">
|
||
|
<PRE>{
|
||
|
// The name/value pair together is a "property".
|
||
|
"propertyName" : "propertyValue"
|
||
|
}
|
||
|
</PRE>
|
||
|
</DIV>
|
||
|
|
||
|
<p>Javascript's <code>number</code> type encompasses all floating-point numbers, which is a broad designation. In this guide, <code>number</code> will refer to JavaScript's <code>number</code> type, while <code>integer</code> will refer to integers.</p>
|
||
|
|
||
|
</DIV>
|
||
|
|
||
|
|
||
|
<DIV class="">
|
||
|
<H2 name="General_Guidelines" id="General_Guidelines">General Guidelines</H2>
|
||
|
|
||
|
<DIV class="">
|
||
|
<H3>
|
||
|
<A name="Comments" id="Comments">Comments</A>
|
||
|
</H3>
|
||
|
<SPAN class="showhide_button" onclick="javascript:ShowHideByName('Comments__body','Comments__button')" name="Comments__button" id="Comments__button">▶</SPAN>
|
||
|
|
||
|
<DIV style="display:inline;" class="">
|
||
|
No comments in JSON objects.
|
||
|
</DIV>
|
||
|
|
||
|
<DIV class="">
|
||
|
<DIV class="stylepoint_body" name="Comments__body" id="Comments__body" style="display: none">
|
||
|
<SPAN class="link_button"><A href="?showone=Comments#Comments">
|
||
|
link
|
||
|
</A></SPAN>
|
||
|
|
||
|
<p>Comments should not be included in JSON objects. Some of the examples in this style guide include comments. However this is only to clarify the examples.</p>
|
||
|
|
||
|
<DIV class="">
|
||
|
<PRE class="badcode">{
|
||
|
// You may see comments in the examples below,
|
||
|
// But don't include comments in your JSON.
|
||
|
"propertyName" : "propertyValue"
|
||
|
}
|
||
|
</PRE>
|
||
|
</DIV>
|
||
|
|
||
|
</DIV>
|
||
|
</DIV>
|
||
|
|
||
|
</DIV>
|
||
|
|
||
|
<DIV class="">
|
||
|
<H3>
|
||
|
<A name="Double_Quotes" id="Double_Quotes">Double Quotes</A>
|
||
|
</H3>
|
||
|
<SPAN class="showhide_button" onclick="javascript:ShowHideByName('Double_Quotes__body','Double_Quotes__button')" name="Double_Quotes__button" id="Double_Quotes__button">▶</SPAN>
|
||
|
|
||
|
<DIV style="display:inline;" class="">
|
||
|
Use double quotes.
|
||
|
</DIV>
|
||
|
|
||
|
<DIV class="">
|
||
|
<DIV class="stylepoint_body" name="Double_Quotes__body" id="Double_Quotes__body" style="display: none">
|
||
|
<SPAN class="link_button"><A href="?showone=Double_Quotes#Double_Quotes">
|
||
|
link
|
||
|
</A></SPAN>
|
||
|
|
||
|
<p>If a property requires quotes, double quotes must be used. All property names must be surrounded by double quotes. Property values of type string must be surrounded by double quotes. Other value types (like boolean or number) do not need double quotes</p>
|
||
|
|
||
|
</DIV>
|
||
|
</DIV>
|
||
|
|
||
|
</DIV>
|
||
|
|
||
|
<DIV class="">
|
||
|
<H3>
|
||
|
<A name="Flattened_data_vs_Structured_Hierarchy" id="Flattened_data_vs_Structured_Hierarchy">Flattened data vs Structured Hierarchy</A>
|
||
|
</H3>
|
||
|
<SPAN class="showhide_button" onclick="javascript:ShowHideByName('Flattened_data_vs_Structured_Hierarchy__body','Flattened_data_vs_Structured_Hierarchy__button')" name="Flattened_data_vs_Structured_Hierarchy__button" id="Flattened_data_vs_Structured_Hierarchy__button">▶</SPAN>
|
||
|
|
||
|
<DIV style="display:inline;" class="">
|
||
|
Data should not be arbitrarily grouped for convenience
|
||
|
</DIV>
|
||
|
|
||
|
<DIV class="">
|
||
|
<DIV class="stylepoint_body" name="Flattened_data_vs_Structured_Hierarchy__body" id="Flattened_data_vs_Structured_Hierarchy__body" style="display: none">
|
||
|
<SPAN class="link_button"><A href="?showone=Flattened_data_vs_Structured_Hierarchy#Flattened_data_vs_Structured_Hierarchy">
|
||
|
link
|
||
|
</A></SPAN>
|
||
|
|
||
|
<p>Data elements should be "flattened" in the JSON representation. Data should not be arbitrarily grouped for convenience.</p>
|
||
|
<p>In some cases, such as a collection of properties that represents a single structure, it may make sense to keep the structured hierarchy. These cases should be carefully considered, and only used if it makes semantic sense. For example, an address could be represented two ways, but the structured way probably makes more sense for developers:</p>
|
||
|
|
||
|
<p>Flattened Address:</p>
|
||
|
|
||
|
<DIV class="">
|
||
|
<PRE>{
|
||
|
"company" : "Google",
|
||
|
"website" : "http://www.google.com/",
|
||
|
"addressLine1" : "111 8th Ave",
|
||
|
"addressLine2" : "4th Floor",
|
||
|
"state" : "NY",
|
||
|
"city" : "New York",
|
||
|
"zip" : "10011"
|
||
|
}</PRE>
|
||
|
</DIV>
|
||
|
|
||
|
<p>Structured Address:</p>
|
||
|
|
||
|
<DIV class="">
|
||
|
<PRE>{
|
||
|
"company" : "Google",
|
||
|
"website" : "http://www.google.com/",
|
||
|
"address" : {
|
||
|
"line1" : "111 8th Ave",
|
||
|
"line2" : "4th Floor",
|
||
|
"state" : "NY",
|
||
|
"city" : "New York",
|
||
|
"zip" : "10011"
|
||
|
}
|
||
|
}</PRE>
|
||
|
</DIV>
|
||
|
|
||
|
</DIV>
|
||
|
</DIV>
|
||
|
|
||
|
</DIV>
|
||
|
|
||
|
</DIV>
|
||
|
|
||
|
<DIV class="">
|
||
|
<H2 name="Property_Name_Guidelines" id="Property_Name_Guidelines">Property Name Guidelines</H2>
|
||
|
|
||
|
<DIV class="">
|
||
|
<H3>
|
||
|
<A name="Property_Name_Format" id="Property_Name_Format">Property Name Format</A>
|
||
|
</H3>
|
||
|
<SPAN class="showhide_button" onclick="javascript:ShowHideByName('Property_Name_Format__body','Property_Name_Format__button')" name="Property_Name_Format__button" id="Property_Name_Format__button">▶</SPAN>
|
||
|
|
||
|
<DIV style="display:inline;" class="">
|
||
|
Choose meaningful property names.
|
||
|
</DIV>
|
||
|
|
||
|
<DIV class="">
|
||
|
<DIV class="stylepoint_body" name="Property_Name_Format__body" id="Property_Name_Format__body" style="display: none">
|
||
|
<SPAN class="link_button"><A href="?showone=Property_Name_Format#Property_Name_Format">
|
||
|
link
|
||
|
</A></SPAN>
|
||
|
|
||
|
<p>Property names must conform to the following guidelines:</p>
|
||
|
<ul>
|
||
|
<li>Property names should be meaningful names with defined semantics.</li>
|
||
|
<li>Property names must be camel-cased, ascii strings.</li>
|
||
|
<li>The first character must be a letter, an underscore (_) or a dollar sign ($).</li>
|
||
|
<li>Subsequent characters can be a letter, a digit, an underscore, or a dollar sign.</li>
|
||
|
<li>Reserved JavaScript keywords should be avoided (A list of reserved JavaScript keywords can be found below).</li>
|
||
|
</ul>
|
||
|
<p>These guidelines mirror the guidelines for naming JavaScript identifiers. This allows JavaScript clients to access properties using dot notation (for example, result.thisIsAnInstanceVariable). Here's an example of an object with one property:</p>
|
||
|
|
||
|
<DIV class="">
|
||
|
<PRE>{
|
||
|
"thisPropertyIsAnIdentifier" : "identifier value"
|
||
|
}
|
||
|
</PRE>
|
||
|
</DIV>
|
||
|
|
||
|
</DIV>
|
||
|
</DIV>
|
||
|
|
||
|
</DIV>
|
||
|
|
||
|
<DIV class="">
|
||
|
<H3>
|
||
|
<A name="Key_Names_in_JSON_Maps" id="Key_Names_in_JSON_Maps">Key Names in JSON Maps</A>
|
||
|
</H3>
|
||
|
<SPAN class="showhide_button" onclick="javascript:ShowHideByName('Key_Names_in_JSON_Maps__body','Key_Names_in_JSON_Maps__button')" name="Key_Names_in_JSON_Maps__button" id="Key_Names_in_JSON_Maps__button">▶</SPAN>
|
||
|
|
||
|
<DIV style="display:inline;" class="">
|
||
|
JSON maps can use any Unicode character in key names.
|
||
|
</DIV>
|
||
|
|
||
|
<DIV class="">
|
||
|
<DIV class="stylepoint_body" name="Key_Names_in_JSON_Maps__body" id="Key_Names_in_JSON_Maps__body" style="display: none">
|
||
|
<SPAN class="link_button"><A href="?showone=Key_Names_in_JSON_Maps#Key_Names_in_JSON_Maps">
|
||
|
link
|
||
|
</A></SPAN>
|
||
|
|
||
|
<p>The property name naming rules do not apply when a JSON object is used as a map. A map (also referred to as associative arrays) is a data type with arbitrary key/value pairs that use the keys to access the corresponding values. JSON objects and JSON maps look the same at runtime; this distinction is relevant to the design of the API. The API documentation should indicate when JSON objects are used as maps.</p>
|
||
|
<p>The keys of a map do not have to obey the naming guidelines for property names. Map keys may contain any Unicode characters. Clients can access these properties using the square bracket notation familiar for maps (for example, result.thumbnails["72"]).</p>
|
||
|
|
||
|
<DIV class="">
|
||
|
<PRE>{
|
||
|
// The "address" property is a sub-object
|
||
|
// holding the parts of an address.
|
||
|
"address": {
|
||
|
"addressLine1": "123 Anystreet",
|
||
|
"city": "Anytown",
|
||
|
"state": "XX",
|
||
|
"zip": "00000"
|
||
|
},
|
||
|
// The "thumbnails" property is a map that maps
|
||
|
// a pixel size to the thumbnail url of that size.
|
||
|
"thumbnails" : {
|
||
|
"72" : "http://url.to.72px.thumbnail",
|
||
|
"144" : "http://url.to.144px.thumbnail"
|
||
|
}
|
||
|
}
|
||
|
</PRE>
|
||
|
</DIV>
|
||
|
|
||
|
</DIV>
|
||
|
</DIV>
|
||
|
|
||
|
</DIV>
|
||
|
|
||
|
<DIV class="">
|
||
|
<H3>
|
||
|
<A name="Reserved_Property_Names" id="Reserved_Property_Names">Reserved Property Names</A>
|
||
|
</H3>
|
||
|
<SPAN class="showhide_button" onclick="javascript:ShowHideByName('Reserved_Property_Names__body','Reserved_Property_Names__button')" name="Reserved_Property_Names__button" id="Reserved_Property_Names__button">▶</SPAN>
|
||
|
|
||
|
<DIV style="display:inline;" class="">
|
||
|
Certain property names are reserved for consistent use across services.
|
||
|
</DIV>
|
||
|
|
||
|
<DIV class="">
|
||
|
<DIV class="stylepoint_body" name="Reserved_Property_Names__body" id="Reserved_Property_Names__body" style="display: none">
|
||
|
<SPAN class="link_button"><A href="?showone=Reserved_Property_Names#Reserved_Property_Names">
|
||
|
link
|
||
|
</A></SPAN>
|
||
|
|
||
|
<p>Details about reserved property names, along with the full list, can be found later on in this guide. Services should avoid using these property names for anything other than their defined semantics.</p>
|
||
|
|
||
|
</DIV>
|
||
|
</DIV>
|
||
|
|
||
|
</DIV>
|
||
|
|
||
|
<DIV class="">
|
||
|
<H3>
|
||
|
<A name="Singular_vs_Plural_Property_Names" id="Singular_vs_Plural_Property_Names">Singular vs Plural Property Names</A>
|
||
|
</H3>
|
||
|
<SPAN class="showhide_button" onclick="javascript:ShowHideByName('Singular_vs_Plural_Property_Names__body','Singular_vs_Plural_Property_Names__button')" name="Singular_vs_Plural_Property_Names__button" id="Singular_vs_Plural_Property_Names__button">▶</SPAN>
|
||
|
|
||
|
<DIV style="display:inline;" class="">
|
||
|
Array types should have plural property names. All other property names should be singular.
|
||
|
</DIV>
|
||
|
|
||
|
<DIV class="">
|
||
|
<DIV class="stylepoint_body" name="Singular_vs_Plural_Property_Names__body" id="Singular_vs_Plural_Property_Names__body" style="display: none">
|
||
|
<SPAN class="link_button"><A href="?showone=Singular_vs_Plural_Property_Names#Singular_vs_Plural_Property_Names">
|
||
|
link
|
||
|
</A></SPAN>
|
||
|
|
||
|
<p>Arrays usually contain multiple items, and a plural property name reflects this. An example of this can be seen in the reserved names below. The "items" property name is plural because it represents an array of item objects. Most of the other fields are singular.</p>
|
||
|
<p>There may be exceptions to this, especially when referring to numeric property values. For example, in the reserved names, "totalItems" makes more sense than "totalItem". However, technically, this is not violating the style guide, since "totalItems" can be viewed as "totalOfItems", where "total" is singular (as per the style guide), and "OfItems" serves to qualify the total. The field name could also be changed to "itemCount" to look singular.</p>
|
||
|
|
||
|
<DIV class="">
|
||
|
<PRE>{
|
||
|
// Singular
|
||
|
"author" : "lisa",
|
||
|
// An array of siblings, plural
|
||
|
"siblings" : [ "bart", "maggie"],
|
||
|
// "totalItem" doesn't sound right
|
||
|
"totalItems" : 10,
|
||
|
// But maybe "itemCount" is better
|
||
|
"itemCount": 10,
|
||
|
}
|
||
|
</PRE>
|
||
|
</DIV>
|
||
|
|
||
|
</DIV>
|
||
|
</DIV>
|
||
|
|
||
|
</DIV>
|
||
|
|
||
|
<DIV class="">
|
||
|
<H3>
|
||
|
<A name="Naming_Conflicts" id="Naming_Conflicts">Naming Conflicts</A>
|
||
|
</H3>
|
||
|
<SPAN class="showhide_button" onclick="javascript:ShowHideByName('Naming_Conflicts__body','Naming_Conflicts__button')" name="Naming_Conflicts__button" id="Naming_Conflicts__button">▶</SPAN>
|
||
|
|
||
|
<DIV style="display:inline;" class="">
|
||
|
Avoid naming conflicts by choosing a new property name, or versioning the API.
|
||
|
</DIV>
|
||
|
|
||
|
<DIV class="">
|
||
|
<DIV class="stylepoint_body" name="Naming_Conflicts__body" id="Naming_Conflicts__body" style="display: none">
|
||
|
<SPAN class="link_button"><A href="?showone=Naming_Conflicts#Naming_Conflicts">
|
||
|
link
|
||
|
</A></SPAN>
|
||
|
|
||
|
<p>New properties may be added to the reserved list in the future. There is no concept of JSON namespacing. If there is a naming conflict, these can usually be resolved by choosing a new property name or by versioning. For example, suppose we start with the following JSON object:</p>
|
||
|
|
||
|
<DIV class="">
|
||
|
<PRE>{
|
||
|
"apiVersion" : "1.0",
|
||
|
"data" : {
|
||
|
"recipeName" : "pizza",
|
||
|
"ingredients" : ["tomatoes", "cheese", "sausage"]
|
||
|
}
|
||
|
}
|
||
|
</PRE>
|
||
|
</DIV>
|
||
|
|
||
|
<p>If in the future we wish to make "ingredients" a reserved word, we can do one of two things:</p>
|
||
|
<p>1) Choose a different name:</p>
|
||
|
|
||
|
<DIV class="">
|
||
|
<PRE>{
|
||
|
"apiVersion" : "1.0",
|
||
|
"data" : {
|
||
|
"recipeName" : "pizza",
|
||
|
"ingredientsData" : "Some new property",
|
||
|
"ingredients" : ["tomatoes", "cheese", "sausage"]
|
||
|
}
|
||
|
}
|
||
|
</PRE>
|
||
|
</DIV>
|
||
|
|
||
|
<p>2) Rename the property on a major version boundary:</p>
|
||
|
|
||
|
<DIV class="">
|
||
|
<PRE>{
|
||
|
"apiVersion" : "2.0",
|
||
|
"data" : {
|
||
|
"recipeName" : "pizza",
|
||
|
"ingredients" : "Some new property",
|
||
|
"recipeIngredients" : ["tomatos", "cheese", "sausage"]
|
||
|
}
|
||
|
}
|
||
|
</PRE>
|
||
|
</DIV>
|
||
|
|
||
|
</DIV>
|
||
|
</DIV>
|
||
|
|
||
|
</DIV>
|
||
|
|
||
|
</DIV>
|
||
|
|
||
|
<DIV class="">
|
||
|
<H2 name="Property_Value_Guidelines" id="Property_Value_Guidelines">Property Value Guidelines</H2>
|
||
|
|
||
|
<DIV class="">
|
||
|
<H3>
|
||
|
<A name="Property_Value_Format" id="Property_Value_Format">Property Value Format</A>
|
||
|
</H3>
|
||
|
<SPAN class="showhide_button" onclick="javascript:ShowHideByName('Property_Value_Format__body','Property_Value_Format__button')" name="Property_Value_Format__button" id="Property_Value_Format__button">▶</SPAN>
|
||
|
|
||
|
<DIV style="display:inline;" class="">
|
||
|
Property values must be Unicode booleans, numbers, strings, objects, arrays, and <code>null</code>.
|
||
|
</DIV>
|
||
|
|
||
|
<DIV class="">
|
||
|
<DIV class="stylepoint_body" name="Property_Value_Format__body" id="Property_Value_Format__body" style="display: none">
|
||
|
<SPAN class="link_button"><A href="?showone=Property_Value_Format#Property_Value_Format">
|
||
|
link
|
||
|
</A></SPAN>
|
||
|
|
||
|
<p>The spec at <a href="http://www.json.org">JSON.org</a> specifies exactly what type of data is allowed in a property value. This includes Unicode booleans, numbers, strings, objects, arrays, and <code>null</code>. JavaScript expressions are not allowed. APIs should support that spec for all values, and should choose the data type most appropriate for a particular property (numbers to represent numbers, etc.).</p>
|
||
|
<p>Good:</p>
|
||
|
|
||
|
<DIV class="">
|
||
|
<PRE>{
|
||
|
"canPigsFly": null, // null
|
||
|
"areWeThereYet": false, // boolean
|
||
|
"answerToLife": 42, // number
|
||
|
"name": "Bart", // string
|
||
|
"moreData": {}, // object
|
||
|
"anArray": [] // array
|
||
|
}
|
||
|
</PRE>
|
||
|
</DIV>
|
||
|
|
||
|
<p>Bad:</p>
|
||
|
|
||
|
<DIV class="">
|
||
|
<PRE class="badcode">{
|
||
|
"aVariableName": aVariableName, // Bad - JavaScript identifier
|
||
|
"functionFoo": function() { return 1; } // Bad - JavaScript function
|
||
|
}
|
||
|
</PRE>
|
||
|
</DIV>
|
||
|
|
||
|
</DIV>
|
||
|
</DIV>
|
||
|
|
||
|
</DIV>
|
||
|
|
||
|
<DIV class="">
|
||
|
<H3>
|
||
|
<A name="Empty/Null_Property_Values" id="Empty/Null_Property_Values">Empty/Null Property Values</A>
|
||
|
</H3>
|
||
|
<SPAN class="showhide_button" onclick="javascript:ShowHideByName('Empty/Null_Property_Values__body','Empty/Null_Property_Values__button')" name="Empty/Null_Property_Values__button" id="Empty/Null_Property_Values__button">▶</SPAN>
|
||
|
|
||
|
<DIV style="display:inline;" class="">
|
||
|
If a property is optional or has an empty/null value, consider dropping the property from the JSON, unless there's a strong semantic reason for its existence.
|
||
|
</DIV>
|
||
|
|
||
|
<DIV class="">
|
||
|
<DIV class="stylepoint_body" name="Empty/Null_Property_Values__body" id="Empty/Null_Property_Values__body" style="display: none">
|
||
|
<SPAN class="link_button"><A href="?showone=Empty/Null_Property_Values#Empty/Null_Property_Values">
|
||
|
link
|
||
|
</A></SPAN>
|
||
|
|
||
|
<p>If a property is optional or has an empty/null value, consider dropping the property from the JSON, unless there's a strong semantic reason for its existence.</p>
|
||
|
|
||
|
<DIV class="">
|
||
|
<PRE>{
|
||
|
"volume" : 10,
|
||
|
// Even though the "balance" property's value is zero, it should be left in,
|
||
|
// since "0" signifies "even balance" (the value could be "-1" for left
|
||
|
// balance and "+1" for right balance.
|
||
|
"balance" : 0,
|
||
|
// The "currentlyPlaying" property can be left out since it is null.
|
||
|
// "currentlyPlaying" : null
|
||
|
}
|
||
|
</PRE>
|
||
|
</DIV>
|
||
|
|
||
|
</DIV>
|
||
|
</DIV>
|
||
|
|
||
|
</DIV>
|
||
|
|
||
|
<DIV class="">
|
||
|
<H3>
|
||
|
<A name="Enum_Values" id="Enum_Values">Enum Values</A>
|
||
|
</H3>
|
||
|
<SPAN class="showhide_button" onclick="javascript:ShowHideByName('Enum_Values__body','Enum_Values__button')" name="Enum_Values__button" id="Enum_Values__button">▶</SPAN>
|
||
|
|
||
|
<DIV style="display:inline;" class="">
|
||
|
Enum values should be represented as strings.
|
||
|
</DIV>
|
||
|
|
||
|
<DIV class="">
|
||
|
<DIV class="stylepoint_body" name="Enum_Values__body" id="Enum_Values__body" style="display: none">
|
||
|
<SPAN class="link_button"><A href="?showone=Enum_Values#Enum_Values">
|
||
|
link
|
||
|
</A></SPAN>
|
||
|
|
||
|
<p>As APIs grow, enum values may be added, removed or changed. Using strings as enum values ensures that downstream clients can gracefully handle changes to enum values.</p>
|
||
|
<p>Java code:</p>
|
||
|
|
||
|
<DIV class="">
|
||
|
<PRE>public enum Color {
|
||
|
WHITE,
|
||
|
BLACK,
|
||
|
RED,
|
||
|
YELLOW,
|
||
|
BLUE
|
||
|
}
|
||
|
</PRE>
|
||
|
</DIV>
|
||
|
|
||
|
<p>JSON Object:</p>
|
||
|
|
||
|
<DIV class="">
|
||
|
<PRE>{
|
||
|
"color" : "WHITE"
|
||
|
}
|
||
|
</PRE>
|
||
|
</DIV>
|
||
|
|
||
|
</DIV>
|
||
|
</DIV>
|
||
|
|
||
|
</DIV>
|
||
|
|
||
|
</DIV>
|
||
|
|
||
|
<DIV class="">
|
||
|
<H2 name="Property_Value_Data_Types" id="Property_Value_Data_Types">Property Value Data Types</H2>
|
||
|
|
||
|
<p>As mentioned above, property value types must be booleans, numbers, strings, objects, arrays, or <code>null</code>. However, it is useful define a set of standard data types when dealing with certain values. These data types will always be strings, but they will be formatted in a specific manner so that they can be easily parsed.</p>
|
||
|
|
||
|
<DIV class="">
|
||
|
<H3>
|
||
|
<A name="Date_Property_Values" id="Date_Property_Values">Date Property Values</A>
|
||
|
</H3>
|
||
|
<SPAN class="showhide_button" onclick="javascript:ShowHideByName('Date_Property_Values__body','Date_Property_Values__button')" name="Date_Property_Values__button" id="Date_Property_Values__button">▶</SPAN>
|
||
|
|
||
|
<DIV style="display:inline;" class="">
|
||
|
Dates should be formatted as recommended by RFC 3339.
|
||
|
</DIV>
|
||
|
|
||
|
<DIV class="">
|
||
|
<DIV class="stylepoint_body" name="Date_Property_Values__body" id="Date_Property_Values__body" style="display: none">
|
||
|
<SPAN class="link_button"><A href="?showone=Date_Property_Values#Date_Property_Values">
|
||
|
link
|
||
|
</A></SPAN>
|
||
|
|
||
|
<p>Dates should be strings formatted as recommended by <a href="http://www.ietf.org/rfc/rfc3339.txt">RFC 3339</a>
|
||
|
</p>
|
||
|
|
||
|
<DIV class="">
|
||
|
<PRE>{
|
||
|
"lastUpdate" : "2007-11-06T16:34:41.000Z"
|
||
|
}
|
||
|
</PRE>
|
||
|
</DIV>
|
||
|
|
||
|
</DIV>
|
||
|
</DIV>
|
||
|
|
||
|
</DIV>
|
||
|
|
||
|
<DIV class="">
|
||
|
<H3>
|
||
|
<A name="Time_Duration_Property_Values" id="Time_Duration_Property_Values">Time Duration Property Values</A>
|
||
|
</H3>
|
||
|
<SPAN class="showhide_button" onclick="javascript:ShowHideByName('Time_Duration_Property_Values__body','Time_Duration_Property_Values__button')" name="Time_Duration_Property_Values__button" id="Time_Duration_Property_Values__button">▶</SPAN>
|
||
|
|
||
|
<DIV style="display:inline;" class="">
|
||
|
Time durations should be formatted as recommended by ISO 8601.
|
||
|
</DIV>
|
||
|
|
||
|
<DIV class="">
|
||
|
<DIV class="stylepoint_body" name="Time_Duration_Property_Values__body" id="Time_Duration_Property_Values__body" style="display: none">
|
||
|
<SPAN class="link_button"><A href="?showone=Time_Duration_Property_Values#Time_Duration_Property_Values">
|
||
|
link
|
||
|
</A></SPAN>
|
||
|
|
||
|
<p>Time duration values should be strings formatted as recommended by <a href="http://en.wikipedia.org/wiki/ISO_8601#Durations">ISO 8601</a>.</p>
|
||
|
|
||
|
<DIV class="">
|
||
|
<PRE>{
|
||
|
// three years, six months, four days, twelve hours,
|
||
|
// thirty minutes, and five seconds
|
||
|
"duration" : "P3Y6M4DT12H30M5S"
|
||
|
}
|
||
|
</PRE>
|
||
|
</DIV>
|
||
|
|
||
|
</DIV>
|
||
|
</DIV>
|
||
|
|
||
|
</DIV>
|
||
|
|
||
|
<DIV class="">
|
||
|
<H3>
|
||
|
<A name="Latitude/Longitude_Property_Values" id="Latitude/Longitude_Property_Values">Latitude/Longitude Property Values</A>
|
||
|
</H3>
|
||
|
<SPAN class="showhide_button" onclick="javascript:ShowHideByName('Latitude/Longitude_Property_Values__body','Latitude/Longitude_Property_Values__button')" name="Latitude/Longitude_Property_Values__button" id="Latitude/Longitude_Property_Values__button">▶</SPAN>
|
||
|
|
||
|
<DIV style="display:inline;" class="">
|
||
|
Latitudes/Longitudes should be formatted as recommended by ISO 6709.
|
||
|
</DIV>
|
||
|
|
||
|
<DIV class="">
|
||
|
<DIV class="stylepoint_body" name="Latitude/Longitude_Property_Values__body" id="Latitude/Longitude_Property_Values__body" style="display: none">
|
||
|
<SPAN class="link_button"><A href="?showone=Latitude/Longitude_Property_Values#Latitude/Longitude_Property_Values">
|
||
|
link
|
||
|
</A></SPAN>
|
||
|
|
||
|
<p>Latitude/Longitude should be strings formatted as recommended by <a href="http://en.wikipedia.org/wiki/ISO_6709">ISO 6709</a>. Furthermore, they should favor the ±DD.DDDD±DDD.DDDD degrees format.</p>
|
||
|
|
||
|
<DIV class="">
|
||
|
<PRE>{
|
||
|
// The latitude/longitude location of the statue of liberty.
|
||
|
"statueOfLiberty" : "+40.6894-074.0447"
|
||
|
}
|
||
|
</PRE>
|
||
|
</DIV>
|
||
|
|
||
|
</DIV>
|
||
|
</DIV>
|
||
|
|
||
|
</DIV>
|
||
|
|
||
|
</DIV>
|
||
|
|
||
|
<DIV class="">
|
||
|
<H2 name="JSON_Structure_&_Reserved_Property_Names" id="JSON_Structure_&_Reserved_Property_Names">JSON Structure & Reserved Property Names</H2>
|
||
|
|
||
|
<p>In order to maintain a consistent interface across APIs, JSON objects should follow the structure outlined below. This structure applies to both requests and responses made with JSON. Within this structure, there are certain property names that are reserved for specific uses. These properties are NOT required; in other words, each reserved property may appear zero or one time. But if a service needs these properties, this naming convention is recommend. Here is a schema of the JSON structure, represented in <a href="http://www.google.com/url?sa=D&q=http%3A%2F%2Forderly-json.org%2F">Orderly</a> format (which in turn can be compiled into a <a href="http://www.google.com/url?sa=D&q=http%3A%2F%2Fjson-schema.org%2F">JSONSchema</a>). You can few examples of the JSON structure at the end of this guide.</p>
|
||
|
|
||
|
<DIV class="">
|
||
|
<PRE>object {
|
||
|
string apiVersion?;
|
||
|
string context?;
|
||
|
string id?;
|
||
|
string method?;
|
||
|
object {
|
||
|
string id?
|
||
|
}* params?;
|
||
|
object {
|
||
|
string kind?;
|
||
|
string fields?;
|
||
|
string etag?;
|
||
|
string id?;
|
||
|
string lang?;
|
||
|
string updated?; # date formatted RFC 3339
|
||
|
boolean deleted?;
|
||
|
integer currentItemCount?;
|
||
|
integer itemsPerPage?;
|
||
|
integer startIndex?;
|
||
|
integer totalItems?;
|
||
|
integer pageIndex?;
|
||
|
integer totalPages?;
|
||
|
string pageLinkTemplate /^https?:/ ?;
|
||
|
object {}* next?;
|
||
|
string nextLink?;
|
||
|
object {}* previous?;
|
||
|
string previousLink?;
|
||
|
object {}* self?;
|
||
|
string selfLink?;
|
||
|
object {}* edit?;
|
||
|
string editLink?;
|
||
|
array [
|
||
|
object {}*;
|
||
|
] items?;
|
||
|
}* data?;
|
||
|
object {
|
||
|
integer code?;
|
||
|
string message?;
|
||
|
array [
|
||
|
object {
|
||
|
string domain?;
|
||
|
string reason?;
|
||
|
string message?;
|
||
|
string location?;
|
||
|
string locationType?;
|
||
|
string extendedHelp?;
|
||
|
string sendReport?;
|
||
|
}*;
|
||
|
] errors?;
|
||
|
}* error?;
|
||
|
}*;
|
||
|
</PRE>
|
||
|
</DIV>
|
||
|
|
||
|
<p>The JSON object has a few top-level properties, followed by either a <code>data</code> object or an <code>error</code> object, but not both. An explanation of each of these properties can be found below.</p>
|
||
|
|
||
|
</DIV>
|
||
|
|
||
|
<DIV class="">
|
||
|
<H2 name="Top-Level_Reserved_Property_Names" id="Top-Level_Reserved_Property_Names">Top-Level Reserved Property Names</H2>
|
||
|
|
||
|
<p>The top-level of the JSON object may contain the following properties.</p>
|
||
|
|
||
|
<DIV class="">
|
||
|
<H3>
|
||
|
<A name="apiVersion" id="apiVersion">apiVersion</A>
|
||
|
</H3>
|
||
|
<SPAN class="showhide_button" onclick="javascript:ShowHideByName('apiVersion__body','apiVersion__button')" name="apiVersion__button" id="apiVersion__button">▶</SPAN>
|
||
|
|
||
|
<DIV style="display:inline;" class="">
|
||
|
Property Value Type: string<br>Parent: -
|
||
|
</DIV>
|
||
|
|
||
|
<DIV class="">
|
||
|
<DIV class="stylepoint_body" name="apiVersion__body" id="apiVersion__body" style="display: none">
|
||
|
<SPAN class="link_button"><A href="?showone=apiVersion#apiVersion">
|
||
|
link
|
||
|
</A></SPAN>
|
||
|
|
||
|
<p>Represents the desired version of the service API in a request, and the version of the service API that's served in the response. "apiVersion" should always be present. This is not related to the version of the data. Versioning of data should be handled through some other mechanism such as etags.</p>
|
||
|
<p>Example:</p>
|
||
|
|
||
|
<DIV class="">
|
||
|
<PRE>{ "apiVersion" : "2.1" }
|
||
|
</PRE>
|
||
|
</DIV>
|
||
|
|
||
|
</DIV>
|
||
|
</DIV>
|
||
|
|
||
|
</DIV>
|
||
|
|
||
|
<DIV class="">
|
||
|
<H3>
|
||
|
<A name="context" id="context">context</A>
|
||
|
</H3>
|
||
|
<SPAN class="showhide_button" onclick="javascript:ShowHideByName('context__body','context__button')" name="context__button" id="context__button">▶</SPAN>
|
||
|
|
||
|
<DIV style="display:inline;" class="">
|
||
|
Property Value Type: string<br>Parent: -
|
||
|
</DIV>
|
||
|
|
||
|
<DIV class="">
|
||
|
<DIV class="stylepoint_body" name="context__body" id="context__body" style="display: none">
|
||
|
<SPAN class="link_button"><A href="?showone=context#context">
|
||
|
link
|
||
|
</A></SPAN>
|
||
|
|
||
|
<p>Client sets this value and server echos data in the response. This is useful in JSON-P and batch situations , where the user can use the "context" to correlate responses with requests. This property is a top-level property because the "context" should present regardless of whether the response was successful or an error. "Context" differs from "id" in that "context" is specified by the user while "id" is assigned by the service.</p>
|
||
|
<p>Example:</p>
|
||
|
<p>Request #1:</p>
|
||
|
|
||
|
<DIV class="">
|
||
|
<PRE>http://www.google.com/myapi?context=bart
|
||
|
</PRE>
|
||
|
</DIV>
|
||
|
|
||
|
<p>Request #2:</p>
|
||
|
|
||
|
<DIV class="">
|
||
|
<PRE>http://www.google.com/myapi?context=lisa
|
||
|
</PRE>
|
||
|
</DIV>
|
||
|
|
||
|
<p>Response #1:</p>
|
||
|
|
||
|
<DIV class="">
|
||
|
<PRE>{
|
||
|
"context" : "bart",
|
||
|
"data" : {
|
||
|
"items" : []
|
||
|
}
|
||
|
}
|
||
|
</PRE>
|
||
|
</DIV>
|
||
|
|
||
|
<p>Response #2:</p>
|
||
|
|
||
|
<DIV class="">
|
||
|
<PRE>{
|
||
|
"context" : "lisa",
|
||
|
"data" : {
|
||
|
"items" : []
|
||
|
}
|
||
|
}
|
||
|
</PRE>
|
||
|
</DIV>
|
||
|
|
||
|
<p>Common JavaScript handler code to process both response:</p>
|
||
|
|
||
|
<DIV class="">
|
||
|
<PRE>function handleResponse(response) {
|
||
|
if (response.result.context == "bart") {
|
||
|
// Update the "Bart" section of the page.
|
||
|
} else if (response.result.context == "lisa") {
|
||
|
// Update the "Lisa" section of the page.
|
||
|
}
|
||
|
}
|
||
|
</PRE>
|
||
|
</DIV>
|
||
|
|
||
|
</DIV>
|
||
|
</DIV>
|
||
|
|
||
|
</DIV>
|
||
|
|
||
|
<DIV class="">
|
||
|
<H3>
|
||
|
<A name="id" id="id">id</A>
|
||
|
</H3>
|
||
|
<SPAN class="showhide_button" onclick="javascript:ShowHideByName('id__body','id__button')" name="id__button" id="id__button">▶</SPAN>
|
||
|
|
||
|
<DIV style="display:inline;" class="">
|
||
|
Property Value Type: string<br>Parent: -
|
||
|
</DIV>
|
||
|
|
||
|
<DIV class="">
|
||
|
<DIV class="stylepoint_body" name="id__body" id="id__body" style="display: none">
|
||
|
<SPAN class="link_button"><A href="?showone=id#id">
|
||
|
link
|
||
|
</A></SPAN>
|
||
|
|
||
|
<p>A server supplied identifier for the response (regardless of whether the response is a success or an error). This is useful for correlating server logs with individual responses received at a client.</p>
|
||
|
<p>Example:</p>
|
||
|
|
||
|
<DIV class="">
|
||
|
<PRE>{ "id" : "1" }
|
||
|
</PRE>
|
||
|
</DIV>
|
||
|
|
||
|
</DIV>
|
||
|
</DIV>
|
||
|
|
||
|
</DIV>
|
||
|
|
||
|
<DIV class="">
|
||
|
<H3>
|
||
|
<A name="method" id="method">method</A>
|
||
|
</H3>
|
||
|
<SPAN class="showhide_button" onclick="javascript:ShowHideByName('method__body','method__button')" name="method__button" id="method__button">▶</SPAN>
|
||
|
|
||
|
<DIV style="display:inline;" class="">
|
||
|
Property Value Type: string<br>Parent: -
|
||
|
</DIV>
|
||
|
|
||
|
<DIV class="">
|
||
|
<DIV class="stylepoint_body" name="method__body" id="method__body" style="display: none">
|
||
|
<SPAN class="link_button"><A href="?showone=method#method">
|
||
|
link
|
||
|
</A></SPAN>
|
||
|
|
||
|
<p>Represents the operation to perform, or that was performed, on the data. In the case of a JSON request, the "method" property can be used to indicate which operation to perform on the data. In the case of a JSON response, the "method" property can indicate the operation performed on the data.</p>
|
||
|
<p>One example of this is in JSON-RPC requests, where "method" indicates the operation to perform on the "params" property:</p>
|
||
|
|
||
|
<DIV class="">
|
||
|
<PRE>{
|
||
|
"method" : "people.get",
|
||
|
"params" : {
|
||
|
"userId" : "@me",
|
||
|
"groupId" : "@self"
|
||
|
}
|
||
|
}
|
||
|
</PRE>
|
||
|
</DIV>
|
||
|
|
||
|
</DIV>
|
||
|
</DIV>
|
||
|
|
||
|
</DIV>
|
||
|
|
||
|
<DIV class="">
|
||
|
<H3>
|
||
|
<A name="params" id="params">params</A>
|
||
|
</H3>
|
||
|
<SPAN class="showhide_button" onclick="javascript:ShowHideByName('params__body','params__button')" name="params__button" id="params__button">▶</SPAN>
|
||
|
|
||
|
<DIV style="display:inline;" class="">
|
||
|
Property Value Type: object<br>Parent: -
|
||
|
</DIV>
|
||
|
|
||
|
<DIV class="">
|
||
|
<DIV class="stylepoint_body" name="params__body" id="params__body" style="display: none">
|
||
|
<SPAN class="link_button"><A href="?showone=params#params">
|
||
|
link
|
||
|
</A></SPAN>
|
||
|
|
||
|
<p>This object serves as a map of input parameters to send to an RPC request. It can be used in conjunction with the "method" property to execute an RPC function. If an RPC function does not need parameters, this property can be omitted.</p>
|
||
|
<p>Example:</p>
|
||
|
|
||
|
<DIV class="">
|
||
|
<PRE>{
|
||
|
"method" : "people.get",
|
||
|
"params" : {
|
||
|
"userId" : "@me",
|
||
|
"groupId" : "@self"
|
||
|
}
|
||
|
}
|
||
|
</PRE>
|
||
|
</DIV>
|
||
|
|
||
|
</DIV>
|
||
|
</DIV>
|
||
|
|
||
|
</DIV>
|
||
|
|
||
|
<DIV class="">
|
||
|
<H3>
|
||
|
<A name="data" id="data">data</A>
|
||
|
</H3>
|
||
|
<SPAN class="showhide_button" onclick="javascript:ShowHideByName('data__body','data__button')" name="data__button" id="data__button">▶</SPAN>
|
||
|
|
||
|
<DIV style="display:inline;" class="">
|
||
|
Property Value Type: object<br>Parent: -
|
||
|
</DIV>
|
||
|
|
||
|
<DIV class="">
|
||
|
<DIV class="stylepoint_body" name="data__body" id="data__body" style="display: none">
|
||
|
<SPAN class="link_button"><A href="?showone=data#data">
|
||
|
link
|
||
|
</A></SPAN>
|
||
|
|
||
|
<p>Container for all the data from a response. This property itself has many reserved property names, which are described below. Services are free to add their own data to this object. A JSON response should contain either a "data" object or an "error" object, but not both. If both "data" and "error" are present, the "error" object takes precedence.</p>
|
||
|
|
||
|
</DIV>
|
||
|
</DIV>
|
||
|
|
||
|
</DIV>
|
||
|
|
||
|
<DIV class="">
|
||
|
<H3>
|
||
|
<A name="error" id="error">error</A>
|
||
|
</H3>
|
||
|
<SPAN class="showhide_button" onclick="javascript:ShowHideByName('error__body','error__button')" name="error__button" id="error__button">▶</SPAN>
|
||
|
|
||
|
<DIV style="display:inline;" class="">
|
||
|
Property Value Type: object<br>Parent: -
|
||
|
</DIV>
|
||
|
|
||
|
<DIV class="">
|
||
|
<DIV class="stylepoint_body" name="error__body" id="error__body" style="display: none">
|
||
|
<SPAN class="link_button"><A href="?showone=error#error">
|
||
|
link
|
||
|
</A></SPAN>
|
||
|
|
||
|
<p>Indicates that an error has occurred, with details about the error. The error format supports either one or more errors returned from the service. A JSON response should contain either a "data" object or an "error" object, but not both. If both "data" and "error" are present, the "error" object takes precedence.</p>
|
||
|
<p>Example:</p>
|
||
|
|
||
|
<DIV class="">
|
||
|
<PRE>{
|
||
|
"apiVersion" : "2.0",
|
||
|
"error" : {
|
||
|
"code" : 404,
|
||
|
"message" : "File Not Found",
|
||
|
"errors" : [{
|
||
|
"domain": "Calendar",
|
||
|
"reason": "ResourceNotFoundException",
|
||
|
"message": "File Not Found
|
||
|
....}]
|
||
|
}
|
||
|
}
|
||
|
</PRE>
|
||
|
</DIV>
|
||
|
|
||
|
</DIV>
|
||
|
</DIV>
|
||
|
|
||
|
</DIV>
|
||
|
|
||
|
</DIV>
|
||
|
|
||
|
<DIV class="">
|
||
|
<H2 name="Reserved_Property_Names_in_the_data_object" id="Reserved_Property_Names_in_the_data_object">Reserved Property Names in the data object</H2>
|
||
|
|
||
|
<p>The "data" property of the JSON object may contain the following properties.</p>
|
||
|
|
||
|
<DIV class="">
|
||
|
<H3>
|
||
|
<A name="data.kind" id="data.kind">data.kind</A>
|
||
|
</H3>
|
||
|
<SPAN class="showhide_button" onclick="javascript:ShowHideByName('data.kind__body','data.kind__button')" name="data.kind__button" id="data.kind__button">▶</SPAN>
|
||
|
|
||
|
<DIV style="display:inline;" class="">
|
||
|
Property Value Type: string<br>Parent: <code>data</code>
|
||
|
|
||
|
</DIV>
|
||
|
|
||
|
<DIV class="">
|
||
|
<DIV class="stylepoint_body" name="data.kind__body" id="data.kind__body" style="display: none">
|
||
|
<SPAN class="link_button"><A href="?showone=data.kind#data.kind">
|
||
|
link
|
||
|
</A></SPAN>
|
||
|
|
||
|
<p>The "kind" property serves as a guide to what type of information this particular object stores. It can be present at the "data" level, or at the "items" level, or in any object where its helpful to distinguish between various types of objects. If the "kind" object is present, it should be the first property in the object (See the "Property Ordering" section below for more details).</p>
|
||
|
<p>Example:</p>
|
||
|
|
||
|
<DIV class="">
|
||
|
<PRE>// "Kind" indicates an "album" in the Picasa API.
|
||
|
{"data": {"kind": "album"}}
|
||
|
</PRE>
|
||
|
</DIV>
|
||
|
|
||
|
</DIV>
|
||
|
</DIV>
|
||
|
|
||
|
</DIV>
|
||
|
|
||
|
<DIV class="">
|
||
|
<H3>
|
||
|
<A name="data.fields" id="data.fields">data.fields</A>
|
||
|
</H3>
|
||
|
<SPAN class="showhide_button" onclick="javascript:ShowHideByName('data.fields__body','data.fields__button')" name="data.fields__button" id="data.fields__button">▶</SPAN>
|
||
|
|
||
|
<DIV style="display:inline;" class="">
|
||
|
Property Value Type: string<br>Parent: <code>data</code>
|
||
|
|
||
|
</DIV>
|
||
|
|
||
|
<DIV class="">
|
||
|
<DIV class="stylepoint_body" name="data.fields__body" id="data.fields__body" style="display: none">
|
||
|
<SPAN class="link_button"><A href="?showone=data.fields#data.fields">
|
||
|
link
|
||
|
</A></SPAN>
|
||
|
|
||
|
<p>Represents the fields present in the response when doing a partial GET, or the fields present in a request when doing a partial PATCH. This property should only exist during a partial GET/PATCH, and should not be empty.</p>
|
||
|
<p>Example:</p>
|
||
|
|
||
|
<DIV class="">
|
||
|
<PRE>{
|
||
|
"data" : {
|
||
|
"kind": "user",
|
||
|
"fields": "author,id",
|
||
|
"id": "bart",
|
||
|
"author": "Bart"
|
||
|
}
|
||
|
}
|
||
|
</PRE>
|
||
|
</DIV>
|
||
|
|
||
|
</DIV>
|
||
|
</DIV>
|
||
|
|
||
|
</DIV>
|
||
|
|
||
|
<DIV class="">
|
||
|
<H3>
|
||
|
<A name="data.etag" id="data.etag">data.etag</A>
|
||
|
</H3>
|
||
|
<SPAN class="showhide_button" onclick="javascript:ShowHideByName('data.etag__body','data.etag__button')" name="data.etag__button" id="data.etag__button">▶</SPAN>
|
||
|
|
||
|
<DIV style="display:inline;" class="">
|
||
|
Property Value Type: string<br>Parent: <code>data</code>
|
||
|
|
||
|
</DIV>
|
||
|
|
||
|
<DIV class="">
|
||
|
<DIV class="stylepoint_body" name="data.etag__body" id="data.etag__body" style="display: none">
|
||
|
<SPAN class="link_button"><A href="?showone=data.etag#data.etag">
|
||
|
link
|
||
|
</A></SPAN>
|
||
|
|
||
|
<p>Represents the etag for the response. Details about ETags in the GData APIs can be found here: <a href="http://code.google.com/apis/gdata/docs/2.0/reference.html#ResourceVersioning">http://code.google.com/apis/gdata/docs/2.0/reference.html#ResourceVersioning</a>
|
||
|
</p>
|
||
|
<p>Example:</p>
|
||
|
|
||
|
<DIV class="">
|
||
|
<PRE>{"data": {"etag": "W/"C0QBRXcycSp7ImA9WxRVFUk.""}}
|
||
|
</PRE>
|
||
|
</DIV>
|
||
|
|
||
|
</DIV>
|
||
|
</DIV>
|
||
|
|
||
|
</DIV>
|
||
|
|
||
|
<DIV class="">
|
||
|
<H3>
|
||
|
<A name="data.id" id="data.id">data.id</A>
|
||
|
</H3>
|
||
|
<SPAN class="showhide_button" onclick="javascript:ShowHideByName('data.id__body','data.id__button')" name="data.id__button" id="data.id__button">▶</SPAN>
|
||
|
|
||
|
<DIV style="display:inline;" class="">
|
||
|
Property Value Type: string<br>Parent: <code>data</code>
|
||
|
|
||
|
</DIV>
|
||
|
|
||
|
<DIV class="">
|
||
|
<DIV class="stylepoint_body" name="data.id__body" id="data.id__body" style="display: none">
|
||
|
<SPAN class="link_button"><A href="?showone=data.id#data.id">
|
||
|
link
|
||
|
</A></SPAN>
|
||
|
|
||
|
<p>A globally unique string used to reference the object. The specific details of the "id" property are left up to the service.</p>
|
||
|
<p>Example:</p>
|
||
|
|
||
|
<DIV class="">
|
||
|
<PRE>{"data": {"id": "12345"}}
|
||
|
</PRE>
|
||
|
</DIV>
|
||
|
|
||
|
</DIV>
|
||
|
</DIV>
|
||
|
|
||
|
</DIV>
|
||
|
|
||
|
<DIV class="">
|
||
|
<H3>
|
||
|
<A name="data.lang" id="data.lang">data.lang</A>
|
||
|
</H3>
|
||
|
<SPAN class="showhide_button" onclick="javascript:ShowHideByName('data.lang__body','data.lang__button')" name="data.lang__button" id="data.lang__button">▶</SPAN>
|
||
|
|
||
|
<DIV style="display:inline;" class="">
|
||
|
Property Value Type: string (formatted as specified in BCP 47)<br>Parent: <code>data (or any child element)</code>
|
||
|
|
||
|
</DIV>
|
||
|
|
||
|
<DIV class="">
|
||
|
<DIV class="stylepoint_body" name="data.lang__body" id="data.lang__body" style="display: none">
|
||
|
<SPAN class="link_button"><A href="?showone=data.lang#data.lang">
|
||
|
link
|
||
|
</A></SPAN>
|
||
|
|
||
|
<p>Indicates the language of the rest of the properties in this object. This property mimics HTML's <code>lang</code> property and XML's <code>xml:lang</code> properties. The value should be a language value as defined in <a href="http://www.rfc-editor.org/rfc/bcp/bcp47.txt">BCP 47</a>. If a single JSON object contains data in multiple languages, the service is responsible for developing and documenting an appropriate location for the <code>lang</code> property.</p>
|
||
|
<p>Example:</p>
|
||
|
|
||
|
<DIV class="">
|
||
|
<PRE>{"data": {
|
||
|
"items": [
|
||
|
{ "lang": "en",
|
||
|
"title": "Hello world!" },
|
||
|
{ "lang": "fr",
|
||
|
"title": "Bonjour monde!" }
|
||
|
]}
|
||
|
}</PRE>
|
||
|
</DIV>
|
||
|
|
||
|
</DIV>
|
||
|
</DIV>
|
||
|
|
||
|
</DIV>
|
||
|
|
||
|
<DIV class="">
|
||
|
<H3>
|
||
|
<A name="data.updated" id="data.updated">data.updated</A>
|
||
|
</H3>
|
||
|
<SPAN class="showhide_button" onclick="javascript:ShowHideByName('data.updated__body','data.updated__button')" name="data.updated__button" id="data.updated__button">▶</SPAN>
|
||
|
|
||
|
<DIV style="display:inline;" class="">
|
||
|
Property Value Type: string (formatted as specified in RFC 3339)<br>Parent: <code>data</code>
|
||
|
|
||
|
</DIV>
|
||
|
|
||
|
<DIV class="">
|
||
|
<DIV class="stylepoint_body" name="data.updated__body" id="data.updated__body" style="display: none">
|
||
|
<SPAN class="link_button"><A href="?showone=data.updated#data.updated">
|
||
|
link
|
||
|
</A></SPAN>
|
||
|
|
||
|
<p>Indicates the last date/time (RFC 3339) the item was updated, as defined by the service.</p>
|
||
|
<p>Example:</p>
|
||
|
|
||
|
<DIV class="">
|
||
|
<PRE>{"data": {"updated": "2007-11-06T16:34:41.000Z"}}
|
||
|
</PRE>
|
||
|
</DIV>
|
||
|
|
||
|
</DIV>
|
||
|
</DIV>
|
||
|
|
||
|
</DIV>
|
||
|
|
||
|
<DIV class="">
|
||
|
<H3>
|
||
|
<A name="data.deleted" id="data.deleted">data.deleted</A>
|
||
|
</H3>
|
||
|
<SPAN class="showhide_button" onclick="javascript:ShowHideByName('data.deleted__body','data.deleted__button')" name="data.deleted__button" id="data.deleted__button">▶</SPAN>
|
||
|
|
||
|
<DIV style="display:inline;" class="">
|
||
|
Property Value Type: boolean<br>Parent: <code>data (or any child element)</code>
|
||
|
|
||
|
</DIV>
|
||
|
|
||
|
<DIV class="">
|
||
|
<DIV class="stylepoint_body" name="data.deleted__body" id="data.deleted__body" style="display: none">
|
||
|
<SPAN class="link_button"><A href="?showone=data.deleted#data.deleted">
|
||
|
link
|
||
|
</A></SPAN>
|
||
|
|
||
|
<p>A marker element, that, when present, indicates the containing entry is deleted. If deleted is present, its value must be <code>true</code>; a value of <code>false</code> can cause confusion and should be avoided.</p>
|
||
|
<p>Example:</p>
|
||
|
|
||
|
<DIV class="">
|
||
|
<PRE>{"data": {
|
||
|
"items": [
|
||
|
{ "title": "A deleted entry",
|
||
|
"deleted": true
|
||
|
}
|
||
|
]}
|
||
|
}
|
||
|
</PRE>
|
||
|
</DIV>
|
||
|
|
||
|
</DIV>
|
||
|
</DIV>
|
||
|
|
||
|
</DIV>
|
||
|
|
||
|
<DIV class="">
|
||
|
<H3>
|
||
|
<A name="data.items" id="data.items">data.items</A>
|
||
|
</H3>
|
||
|
<SPAN class="showhide_button" onclick="javascript:ShowHideByName('data.items__body','data.items__button')" name="data.items__button" id="data.items__button">▶</SPAN>
|
||
|
|
||
|
<DIV style="display:inline;" class="">
|
||
|
Property Value Type: array<br>Parent: <code>data</code>
|
||
|
|
||
|
</DIV>
|
||
|
|
||
|
<DIV class="">
|
||
|
<DIV class="stylepoint_body" name="data.items__body" id="data.items__body" style="display: none">
|
||
|
<SPAN class="link_button"><A href="?showone=data.items#data.items">
|
||
|
link
|
||
|
</A></SPAN>
|
||
|
|
||
|
<p>The property name "items" is reserved to represent an array of items (for example, photos in Picasa, videos in YouTube). This construct is intended to provide a standard location for collections related to the current result. For example, the JSON output could be plugged into a generic pagination system that knows to page on the "items" array. If "items" exists, it should be the last property in the "data" object (See the "Property Ordering" section below for more details).</p>
|
||
|
<p>Example:</p>
|
||
|
|
||
|
<DIV class="">
|
||
|
<PRE>{
|
||
|
"data" {
|
||
|
"items" : [
|
||
|
{ /* Object #1 */ },
|
||
|
{ /* Object #2 */ },
|
||
|
...
|
||
|
]
|
||
|
}
|
||
|
}
|
||
|
</PRE>
|
||
|
</DIV>
|
||
|
|
||
|
</DIV>
|
||
|
</DIV>
|
||
|
|
||
|
</DIV>
|
||
|
|
||
|
</DIV>
|
||
|
|
||
|
<DIV class="">
|
||
|
<H2 name="Reserved_Property_Names_for_Paging" id="Reserved_Property_Names_for_Paging">Reserved Property Names for Paging</H2>
|
||
|
|
||
|
<p>The following properties are located in the "data" object, and are related to paging items. Some of the language and concepts are borrowed from the <a href="TDOD">OpenSearch specification</a>. The paging properties listed below allows users to page based on number of items. However some services may wish to offer page-based paging. For example, rather than jump to item number 200, some services may request page number 20. For these cases, two page-based properties have been added: "pageIndex" and "totalPages". An example of how to use these properties to implement paging can be found at the end of this guide.</p>
|
||
|
|
||
|
<DIV class="">
|
||
|
<H3>
|
||
|
<A name="data.currentItemCount" id="data.currentItemCount">data.currentItemCount</A>
|
||
|
</H3>
|
||
|
<SPAN class="showhide_button" onclick="javascript:ShowHideByName('data.currentItemCount__body','data.currentItemCount__button')" name="data.currentItemCount__button" id="data.currentItemCount__button">▶</SPAN>
|
||
|
|
||
|
<DIV style="display:inline;" class="">
|
||
|
Property Value Type: integer<br>Parent: <code>data</code>
|
||
|
|
||
|
</DIV>
|
||
|
|
||
|
<DIV class="">
|
||
|
<DIV class="stylepoint_body" name="data.currentItemCount__body" id="data.currentItemCount__body" style="display: none">
|
||
|
<SPAN class="link_button"><A href="?showone=data.currentItemCount#data.currentItemCount">
|
||
|
link
|
||
|
</A></SPAN>
|
||
|
|
||
|
<p>The number of items in this result set. Should be equivalent to items.length, and is provided as a convenience property. Say for example a developer requests a set of search items, and asks for 10 items per page. The total set of that search has 14 total items. The first page of items will have 10 items in it, so both "itemsPerPage" and "currentItemCount" will equal "10". The next page of items will have the remaining 4 items; "itemsPerPage" will still be "10", but "currentItemCount" will be "4".</p>
|
||
|
<p>Example:</p>
|
||
|
|
||
|
<DIV class="">
|
||
|
<PRE>{
|
||
|
"data": {
|
||
|
// "itemsPerPage" does not necessarily match "currentItemCount"
|
||
|
"itemsPerPage": 10,
|
||
|
"currentItemCount": 4
|
||
|
}
|
||
|
}
|
||
|
</PRE>
|
||
|
</DIV>
|
||
|
|
||
|
</DIV>
|
||
|
</DIV>
|
||
|
|
||
|
</DIV>
|
||
|
|
||
|
<DIV class="">
|
||
|
<H3>
|
||
|
<A name="data.itemsPerPage" id="data.itemsPerPage">data.itemsPerPage</A>
|
||
|
</H3>
|
||
|
<SPAN class="showhide_button" onclick="javascript:ShowHideByName('data.itemsPerPage__body','data.itemsPerPage__button')" name="data.itemsPerPage__button" id="data.itemsPerPage__button">▶</SPAN>
|
||
|
|
||
|
<DIV style="display:inline;" class="">
|
||
|
Property Value Type: integer<br>Parent: <code>data</code>
|
||
|
|
||
|
</DIV>
|
||
|
|
||
|
<DIV class="">
|
||
|
<DIV class="stylepoint_body" name="data.itemsPerPage__body" id="data.itemsPerPage__body" style="display: none">
|
||
|
<SPAN class="link_button"><A href="?showone=data.itemsPerPage#data.itemsPerPage">
|
||
|
link
|
||
|
</A></SPAN>
|
||
|
|
||
|
<p>The number of items in the result. This is not necessarily the size of the data.items array; if we are viewing the last page of items, the size of data.items may be less than "itemsPerPage". However the size of data.items should not exceed "itemsPerPage".</p>
|
||
|
<p>Example:</p>
|
||
|
|
||
|
<DIV class="">
|
||
|
<PRE>{
|
||
|
"data": {
|
||
|
"itemsPerPage": 10
|
||
|
}
|
||
|
}
|
||
|
</PRE>
|
||
|
</DIV>
|
||
|
|
||
|
</DIV>
|
||
|
</DIV>
|
||
|
|
||
|
</DIV>
|
||
|
|
||
|
<DIV class="">
|
||
|
<H3>
|
||
|
<A name="data.startIndex" id="data.startIndex">data.startIndex</A>
|
||
|
</H3>
|
||
|
<SPAN class="showhide_button" onclick="javascript:ShowHideByName('data.startIndex__body','data.startIndex__button')" name="data.startIndex__button" id="data.startIndex__button">▶</SPAN>
|
||
|
|
||
|
<DIV style="display:inline;" class="">
|
||
|
Property Value Type: integer<br>Parent: <code>data</code>
|
||
|
|
||
|
</DIV>
|
||
|
|
||
|
<DIV class="">
|
||
|
<DIV class="stylepoint_body" name="data.startIndex__body" id="data.startIndex__body" style="display: none">
|
||
|
<SPAN class="link_button"><A href="?showone=data.startIndex#data.startIndex">
|
||
|
link
|
||
|
</A></SPAN>
|
||
|
|
||
|
<p>The index of the first item in data.items. For consistency, "startIndex" should be 1-based. For example, the first item in the first set of items should have a "startIndex" of 1. If the user requests the next set of data, the "startIndex" may be 10.</p>
|
||
|
<p>Example:</p>
|
||
|
|
||
|
<DIV class="">
|
||
|
<PRE>{
|
||
|
"data": {
|
||
|
"startIndex": 1
|
||
|
}
|
||
|
}
|
||
|
</PRE>
|
||
|
</DIV>
|
||
|
|
||
|
</DIV>
|
||
|
</DIV>
|
||
|
|
||
|
</DIV>
|
||
|
|
||
|
<DIV class="">
|
||
|
<H3>
|
||
|
<A name="data.totalItems" id="data.totalItems">data.totalItems</A>
|
||
|
</H3>
|
||
|
<SPAN class="showhide_button" onclick="javascript:ShowHideByName('data.totalItems__body','data.totalItems__button')" name="data.totalItems__button" id="data.totalItems__button">▶</SPAN>
|
||
|
|
||
|
<DIV style="display:inline;" class="">
|
||
|
Property Value Type: integer<br>Parent: <code>data</code>
|
||
|
|
||
|
</DIV>
|
||
|
|
||
|
<DIV class="">
|
||
|
<DIV class="stylepoint_body" name="data.totalItems__body" id="data.totalItems__body" style="display: none">
|
||
|
<SPAN class="link_button"><A href="?showone=data.totalItems#data.totalItems">
|
||
|
link
|
||
|
</A></SPAN>
|
||
|
|
||
|
<p>The total number of items available in this set. For example, if a user has 100 blog posts, the response may only contain 10 items, but the "totalItems" would be 100.</p>
|
||
|
<p>Example:</p>
|
||
|
|
||
|
<DIV class="">
|
||
|
<PRE>{
|
||
|
"data": {
|
||
|
"totalItems": 100
|
||
|
}
|
||
|
}
|
||
|
</PRE>
|
||
|
</DIV>
|
||
|
|
||
|
</DIV>
|
||
|
</DIV>
|
||
|
|
||
|
</DIV>
|
||
|
|
||
|
<DIV class="">
|
||
|
<H3>
|
||
|
<A name="data.pagingLinkTemplate" id="data.pagingLinkTemplate">data.pagingLinkTemplate</A>
|
||
|
</H3>
|
||
|
<SPAN class="showhide_button" onclick="javascript:ShowHideByName('data.pagingLinkTemplate__body','data.pagingLinkTemplate__button')" name="data.pagingLinkTemplate__button" id="data.pagingLinkTemplate__button">▶</SPAN>
|
||
|
|
||
|
<DIV style="display:inline;" class="">
|
||
|
Property Value Type: string<br>Parent: <code>data</code>
|
||
|
|
||
|
</DIV>
|
||
|
|
||
|
<DIV class="">
|
||
|
<DIV class="stylepoint_body" name="data.pagingLinkTemplate__body" id="data.pagingLinkTemplate__body" style="display: none">
|
||
|
<SPAN class="link_button"><A href="?showone=data.pagingLinkTemplate#data.pagingLinkTemplate">
|
||
|
link
|
||
|
</A></SPAN>
|
||
|
|
||
|
<p>A uri template indicating how users can calculate subsequent paging links. The uri template also has some reserved variable names: {index} representing the item number to load, and {pageIndex}, representing the page number to load.</p>
|
||
|
<p>Example:</p>
|
||
|
|
||
|
<DIV class="">
|
||
|
<PRE>{
|
||
|
"data": {
|
||
|
"pagingLinkTemplate" : "http://www.google.com/search/hl=en&q=chicago+style+pizza&start={index}&sa=N"
|
||
|
}
|
||
|
}
|
||
|
</PRE>
|
||
|
</DIV>
|
||
|
|
||
|
</DIV>
|
||
|
</DIV>
|
||
|
|
||
|
</DIV>
|
||
|
|
||
|
<DIV class="">
|
||
|
<H3>
|
||
|
<A name="data.pageIndex" id="data.pageIndex">data.pageIndex</A>
|
||
|
</H3>
|
||
|
<SPAN class="showhide_button" onclick="javascript:ShowHideByName('data.pageIndex__body','data.pageIndex__button')" name="data.pageIndex__button" id="data.pageIndex__button">▶</SPAN>
|
||
|
|
||
|
<DIV style="display:inline;" class="">
|
||
|
Property Value Type: integer<br>Parent: <code>data</code>
|
||
|
|
||
|
</DIV>
|
||
|
|
||
|
<DIV class="">
|
||
|
<DIV class="stylepoint_body" name="data.pageIndex__body" id="data.pageIndex__body" style="display: none">
|
||
|
<SPAN class="link_button"><A href="?showone=data.pageIndex#data.pageIndex">
|
||
|
link
|
||
|
</A></SPAN>
|
||
|
|
||
|
<p>The index of the current page of items. For consistency, "pageIndex" should be 1-based. For example, the first page of items has a "pageIndex" of 1. "pageIndex" can also be calculated from the item-based paging properties: "pageIndex" = floor(startIndex / itemsPerPage) + 1.</p>
|
||
|
<p>Example:</p>
|
||
|
|
||
|
<DIV class="">
|
||
|
<PRE>{
|
||
|
"data": {
|
||
|
"pageIndex" : 1
|
||
|
}
|
||
|
}
|
||
|
</PRE>
|
||
|
</DIV>
|
||
|
|
||
|
</DIV>
|
||
|
</DIV>
|
||
|
|
||
|
</DIV>
|
||
|
|
||
|
<DIV class="">
|
||
|
<H3>
|
||
|
<A name="data.totalPages" id="data.totalPages">data.totalPages</A>
|
||
|
</H3>
|
||
|
<SPAN class="showhide_button" onclick="javascript:ShowHideByName('data.totalPages__body','data.totalPages__button')" name="data.totalPages__button" id="data.totalPages__button">▶</SPAN>
|
||
|
|
||
|
<DIV style="display:inline;" class="">
|
||
|
Property Value Type: integer<br>Parent: <code>data</code>
|
||
|
|
||
|
</DIV>
|
||
|
|
||
|
<DIV class="">
|
||
|
<DIV class="stylepoint_body" name="data.totalPages__body" id="data.totalPages__body" style="display: none">
|
||
|
<SPAN class="link_button"><A href="?showone=data.totalPages#data.totalPages">
|
||
|
link
|
||
|
</A></SPAN>
|
||
|
|
||
|
<p>The total number of pages in the result set. "totalPages" can also be calculated from the item-based paging properties above: "totalPages" = ceiling(totalItems / itemsPerPage).</p>
|
||
|
<p>Example:</p>
|
||
|
|
||
|
<DIV class="">
|
||
|
<PRE>{
|
||
|
"data": {
|
||
|
"totalPages" : 50
|
||
|
}
|
||
|
}
|
||
|
</PRE>
|
||
|
</DIV>
|
||
|
|
||
|
</DIV>
|
||
|
</DIV>
|
||
|
|
||
|
</DIV>
|
||
|
|
||
|
</DIV>
|
||
|
|
||
|
<DIV class="">
|
||
|
<H2 name="Reserved_Property_Names_for_Links" id="Reserved_Property_Names_for_Links">Reserved Property Names for Links</H2>
|
||
|
|
||
|
<p>The following properties are located in the "data" object, and represent references to other resources. There are two forms of link properties: 1) objects, which can contain any sort of reference (such as a JSON-RPC object), and 2) uri strings, which represent uris to resources (and will always be suffixed with "Link").</p>
|
||
|
|
||
|
<DIV class="">
|
||
|
<H3>
|
||
|
<A name="data.self_/_data.selfLink" id="data.self_/_data.selfLink">data.self / data.selfLink</A>
|
||
|
</H3>
|
||
|
<SPAN class="showhide_button" onclick="javascript:ShowHideByName('data.self_/_data.selfLink__body','data.self_/_data.selfLink__button')" name="data.self_/_data.selfLink__button" id="data.self_/_data.selfLink__button">▶</SPAN>
|
||
|
|
||
|
<DIV style="display:inline;" class="">
|
||
|
Property Value Type: object / string<br>Parent: <code>data</code>
|
||
|
|
||
|
</DIV>
|
||
|
|
||
|
<DIV class="">
|
||
|
<DIV class="stylepoint_body" name="data.self_/_data.selfLink__body" id="data.self_/_data.selfLink__body" style="display: none">
|
||
|
<SPAN class="link_button"><A href="?showone=data.self_/_data.selfLink#data.self_/_data.selfLink">
|
||
|
link
|
||
|
</A></SPAN>
|
||
|
|
||
|
<p>The self link can be used to retrieve the item's data. For example, in a list of a user's Picasa album, each album object in the "items" array could contain a "selfLink" that can be used to retrieve data related to that particular album.</p>
|
||
|
<p>Example:</p>
|
||
|
|
||
|
<DIV class="">
|
||
|
<PRE>{
|
||
|
"data": {
|
||
|
"self" : { },
|
||
|
"selfLink" : "http://www.google.com/feeds/album/1234"
|
||
|
}
|
||
|
}
|
||
|
</PRE>
|
||
|
</DIV>
|
||
|
|
||
|
</DIV>
|
||
|
</DIV>
|
||
|
|
||
|
</DIV>
|
||
|
|
||
|
<DIV class="">
|
||
|
<H3>
|
||
|
<A name="data.edit_/_data.editLink" id="data.edit_/_data.editLink">data.edit / data.editLink</A>
|
||
|
</H3>
|
||
|
<SPAN class="showhide_button" onclick="javascript:ShowHideByName('data.edit_/_data.editLink__body','data.edit_/_data.editLink__button')" name="data.edit_/_data.editLink__button" id="data.edit_/_data.editLink__button">▶</SPAN>
|
||
|
|
||
|
<DIV style="display:inline;" class="">
|
||
|
Property Value Type: object / string<br>Parent: <code>data</code>
|
||
|
|
||
|
</DIV>
|
||
|
|
||
|
<DIV class="">
|
||
|
<DIV class="stylepoint_body" name="data.edit_/_data.editLink__body" id="data.edit_/_data.editLink__body" style="display: none">
|
||
|
<SPAN class="link_button"><A href="?showone=data.edit_/_data.editLink#data.edit_/_data.editLink">
|
||
|
link
|
||
|
</A></SPAN>
|
||
|
|
||
|
<p>The edit link indicates where a user can send update or delete requests. This is useful for REST-based APIs. This link need only be present if the user can update/delete this item.</p>
|
||
|
<p>Example:</p>
|
||
|
|
||
|
<DIV class="">
|
||
|
<PRE>{
|
||
|
"data": {
|
||
|
"edit" : { },
|
||
|
"editLink" : "http://www.google.com/feeds/album/1234/edit"
|
||
|
}
|
||
|
}
|
||
|
</PRE>
|
||
|
</DIV>
|
||
|
|
||
|
</DIV>
|
||
|
</DIV>
|
||
|
|
||
|
</DIV>
|
||
|
|
||
|
<DIV class="">
|
||
|
<H3>
|
||
|
<A name="data.next_/_data.nextLink" id="data.next_/_data.nextLink">data.next / data.nextLink</A>
|
||
|
</H3>
|
||
|
<SPAN class="showhide_button" onclick="javascript:ShowHideByName('data.next_/_data.nextLink__body','data.next_/_data.nextLink__button')" name="data.next_/_data.nextLink__button" id="data.next_/_data.nextLink__button">▶</SPAN>
|
||
|
|
||
|
<DIV style="display:inline;" class="">
|
||
|
Property Value Type: object / string<br>Parent: <code>data</code>
|
||
|
|
||
|
</DIV>
|
||
|
|
||
|
<DIV class="">
|
||
|
<DIV class="stylepoint_body" name="data.next_/_data.nextLink__body" id="data.next_/_data.nextLink__body" style="display: none">
|
||
|
<SPAN class="link_button"><A href="?showone=data.next_/_data.nextLink#data.next_/_data.nextLink">
|
||
|
link
|
||
|
</A></SPAN>
|
||
|
|
||
|
<p>The next link indicates how more data can be retrieved. It points to the location to load the next set of data. It can be used in conjunction with the itemsPerPage, startIndex and totalItems properties in order to page through data.</p>
|
||
|
<p>Example:</p>
|
||
|
|
||
|
<DIV class="">
|
||
|
<PRE>{
|
||
|
"data": {
|
||
|
"next" : { },
|
||
|
"nextLink" : "http://www.google.com/feeds/album/1234/next"
|
||
|
}
|
||
|
}
|
||
|
</PRE>
|
||
|
</DIV>
|
||
|
|
||
|
</DIV>
|
||
|
</DIV>
|
||
|
|
||
|
</DIV>
|
||
|
|
||
|
<DIV class="">
|
||
|
<H3>
|
||
|
<A name="data.previous_/_data.previousLink" id="data.previous_/_data.previousLink">data.previous / data.previousLink</A>
|
||
|
</H3>
|
||
|
<SPAN class="showhide_button" onclick="javascript:ShowHideByName('data.previous_/_data.previousLink__body','data.previous_/_data.previousLink__button')" name="data.previous_/_data.previousLink__button" id="data.previous_/_data.previousLink__button">▶</SPAN>
|
||
|
|
||
|
<DIV style="display:inline;" class="">
|
||
|
Property Value Type: object / string<br>Parent: <code>data</code>
|
||
|
|
||
|
</DIV>
|
||
|
|
||
|
<DIV class="">
|
||
|
<DIV class="stylepoint_body" name="data.previous_/_data.previousLink__body" id="data.previous_/_data.previousLink__body" style="display: none">
|
||
|
<SPAN class="link_button"><A href="?showone=data.previous_/_data.previousLink#data.previous_/_data.previousLink">
|
||
|
link
|
||
|
</A></SPAN>
|
||
|
|
||
|
<p>The previous link indicates how more data can be retrieved. It points to the location to load the previous set of data. It can be used in conjunction with the itemsPerPage, startIndex and totalItems properties in order to page through data.</p>
|
||
|
<p>Example:</p>
|
||
|
|
||
|
<DIV class="">
|
||
|
<PRE>{
|
||
|
"data": {
|
||
|
"previous" : { },
|
||
|
"previousLink" : "http://www.google.com/feeds/album/1234/next"
|
||
|
}
|
||
|
}
|
||
|
</PRE>
|
||
|
</DIV>
|
||
|
|
||
|
</DIV>
|
||
|
</DIV>
|
||
|
|
||
|
</DIV>
|
||
|
|
||
|
</DIV>
|
||
|
|
||
|
<DIV class="">
|
||
|
<H2 name="Reserved_Property_Names_in_the_error_object" id="Reserved_Property_Names_in_the_error_object">Reserved Property Names in the error object</H2>
|
||
|
|
||
|
<p>The "error" property of the JSON object may contain the following properties.</p>
|
||
|
|
||
|
<DIV class="">
|
||
|
<H3>
|
||
|
<A name="error.code" id="error.code">error.code</A>
|
||
|
</H3>
|
||
|
<SPAN class="showhide_button" onclick="javascript:ShowHideByName('error.code__body','error.code__button')" name="error.code__button" id="error.code__button">▶</SPAN>
|
||
|
|
||
|
<DIV style="display:inline;" class="">
|
||
|
Property Value Type: integer<br>Parent: <code>error</code>
|
||
|
|
||
|
</DIV>
|
||
|
|
||
|
<DIV class="">
|
||
|
<DIV class="stylepoint_body" name="error.code__body" id="error.code__body" style="display: none">
|
||
|
<SPAN class="link_button"><A href="?showone=error.code#error.code">
|
||
|
link
|
||
|
</A></SPAN>
|
||
|
|
||
|
<p>Represents the code for this error. This property value will usually represent the HTTP response code. If there are multiple errors, <code>code</code> will be the error code for the first error.</p>
|
||
|
<p>Example:</p>
|
||
|
|
||
|
<DIV class="">
|
||
|
<PRE>{
|
||
|
"error":{
|
||
|
"code": 404
|
||
|
}
|
||
|
}
|
||
|
</PRE>
|
||
|
</DIV>
|
||
|
|
||
|
</DIV>
|
||
|
</DIV>
|
||
|
|
||
|
</DIV>
|
||
|
|
||
|
<DIV class="">
|
||
|
<H3>
|
||
|
<A name="error.message" id="error.message">error.message</A>
|
||
|
</H3>
|
||
|
<SPAN class="showhide_button" onclick="javascript:ShowHideByName('error.message__body','error.message__button')" name="error.message__button" id="error.message__button">▶</SPAN>
|
||
|
|
||
|
<DIV style="display:inline;" class="">
|
||
|
Property Value Type: string<br>Parent: <code>error</code>
|
||
|
|
||
|
</DIV>
|
||
|
|
||
|
<DIV class="">
|
||
|
<DIV class="stylepoint_body" name="error.message__body" id="error.message__body" style="display: none">
|
||
|
<SPAN class="link_button"><A href="?showone=error.message#error.message">
|
||
|
link
|
||
|
</A></SPAN>
|
||
|
|
||
|
<p>A human readable message providing more details about the error. If there are multiple errors, <code>message</code> will be the message for the first error.</p>
|
||
|
<p>Example:</p>
|
||
|
|
||
|
<DIV class="">
|
||
|
<PRE>{
|
||
|
"error":{
|
||
|
"message": "File Not Found"
|
||
|
}
|
||
|
}
|
||
|
</PRE>
|
||
|
</DIV>
|
||
|
|
||
|
</DIV>
|
||
|
</DIV>
|
||
|
|
||
|
</DIV>
|
||
|
|
||
|
<DIV class="">
|
||
|
<H3>
|
||
|
<A name="error.errors" id="error.errors">error.errors</A>
|
||
|
</H3>
|
||
|
<SPAN class="showhide_button" onclick="javascript:ShowHideByName('error.errors__body','error.errors__button')" name="error.errors__button" id="error.errors__button">▶</SPAN>
|
||
|
|
||
|
<DIV style="display:inline;" class="">
|
||
|
Property Value Type: array<br>Parent: <code>error</code>
|
||
|
|
||
|
</DIV>
|
||
|
|
||
|
<DIV class="">
|
||
|
<DIV class="stylepoint_body" name="error.errors__body" id="error.errors__body" style="display: none">
|
||
|
<SPAN class="link_button"><A href="?showone=error.errors#error.errors">
|
||
|
link
|
||
|
</A></SPAN>
|
||
|
|
||
|
<p>Container for any additional information regarding the error. If the service returns multiple errors, each element in the <code>errors</code> array represents a different error.</p>
|
||
|
<p>Example:</p>
|
||
|
|
||
|
<DIV class="">
|
||
|
<PRE>{ "error" : { "errors" : [] } }
|
||
|
</PRE>
|
||
|
</DIV>
|
||
|
|
||
|
</DIV>
|
||
|
</DIV>
|
||
|
|
||
|
</DIV>
|
||
|
|
||
|
<DIV class="">
|
||
|
<H3>
|
||
|
<A name="error.errors[].domain" id="error.errors[].domain">error.errors[].domain</A>
|
||
|
</H3>
|
||
|
<SPAN class="showhide_button" onclick="javascript:ShowHideByName('error.errors[].domain__body','error.errors[].domain__button')" name="error.errors[].domain__button" id="error.errors[].domain__button">▶</SPAN>
|
||
|
|
||
|
<DIV style="display:inline;" class="">
|
||
|
Property Value Type: string<br>Parent: <code>error.errors</code>
|
||
|
|
||
|
</DIV>
|
||
|
|
||
|
<DIV class="">
|
||
|
<DIV class="stylepoint_body" name="error.errors[].domain__body" id="error.errors[].domain__body" style="display: none">
|
||
|
<SPAN class="link_button"><A href="?showone=error.errors[].domain#error.errors[].domain">
|
||
|
link
|
||
|
</A></SPAN>
|
||
|
|
||
|
<p>Unique identifier for the service raising this error. This helps distinguish service-specific errors (i.e. error inserting an event in a calendar) from general protocol errors (i.e. file not found).</p>
|
||
|
<p>Example:</p>
|
||
|
|
||
|
<DIV class="">
|
||
|
<PRE>{
|
||
|
"error":{
|
||
|
"errors": [{"domain": "Calendar"}]
|
||
|
}
|
||
|
}
|
||
|
</PRE>
|
||
|
</DIV>
|
||
|
|
||
|
</DIV>
|
||
|
</DIV>
|
||
|
|
||
|
</DIV>
|
||
|
|
||
|
<DIV class="">
|
||
|
<H3>
|
||
|
<A name="error.errors[].reason" id="error.errors[].reason">error.errors[].reason</A>
|
||
|
</H3>
|
||
|
<SPAN class="showhide_button" onclick="javascript:ShowHideByName('error.errors[].reason__body','error.errors[].reason__button')" name="error.errors[].reason__button" id="error.errors[].reason__button">▶</SPAN>
|
||
|
|
||
|
<DIV style="display:inline;" class="">
|
||
|
Property Value Type: string<br>Parent: <code>error.errors</code>
|
||
|
|
||
|
</DIV>
|
||
|
|
||
|
<DIV class="">
|
||
|
<DIV class="stylepoint_body" name="error.errors[].reason__body" id="error.errors[].reason__body" style="display: none">
|
||
|
<SPAN class="link_button"><A href="?showone=error.errors[].reason#error.errors[].reason">
|
||
|
link
|
||
|
</A></SPAN>
|
||
|
|
||
|
<p>Unique identifier for this error. Different from the <code>error.code</code> property in that this is not an http response code.</p>
|
||
|
<p>Example:</p>
|
||
|
|
||
|
<DIV class="">
|
||
|
<PRE>{
|
||
|
"error":{
|
||
|
"errors": [{"reason": "ResourceNotFoundException"}]
|
||
|
}
|
||
|
}
|
||
|
</PRE>
|
||
|
</DIV>
|
||
|
|
||
|
</DIV>
|
||
|
</DIV>
|
||
|
|
||
|
</DIV>
|
||
|
|
||
|
<DIV class="">
|
||
|
<H3>
|
||
|
<A name="error.errors[].message" id="error.errors[].message">error.errors[].message</A>
|
||
|
</H3>
|
||
|
<SPAN class="showhide_button" onclick="javascript:ShowHideByName('error.errors[].message__body','error.errors[].message__button')" name="error.errors[].message__button" id="error.errors[].message__button">▶</SPAN>
|
||
|
|
||
|
<DIV style="display:inline;" class="">
|
||
|
Property Value Type: string<br>Parent: <code>error.errors</code>
|
||
|
|
||
|
</DIV>
|
||
|
|
||
|
<DIV class="">
|
||
|
<DIV class="stylepoint_body" name="error.errors[].message__body" id="error.errors[].message__body" style="display: none">
|
||
|
<SPAN class="link_button"><A href="?showone=error.errors[].message#error.errors[].message">
|
||
|
link
|
||
|
</A></SPAN>
|
||
|
|
||
|
<p>A human readable message providing more details about the error. If there is only one error, this field will match <code>error.message</code>.</p>
|
||
|
<p>Example:</p>
|
||
|
|
||
|
<DIV class="">
|
||
|
<PRE>{
|
||
|
"error":{
|
||
|
"code": 404
|
||
|
"message": "File Not Found",
|
||
|
"errors": [{"message": "File Not Found"}]
|
||
|
}
|
||
|
}
|
||
|
</PRE>
|
||
|
</DIV>
|
||
|
|
||
|
</DIV>
|
||
|
</DIV>
|
||
|
|
||
|
</DIV>
|
||
|
|
||
|
<DIV class="">
|
||
|
<H3>
|
||
|
<A name="error.errors[].location" id="error.errors[].location">error.errors[].location</A>
|
||
|
</H3>
|
||
|
<SPAN class="showhide_button" onclick="javascript:ShowHideByName('error.errors[].location__body','error.errors[].location__button')" name="error.errors[].location__button" id="error.errors[].location__button">▶</SPAN>
|
||
|
|
||
|
<DIV style="display:inline;" class="">
|
||
|
Property Value Type: string<br>Parent: <code>error.errors</code>
|
||
|
|
||
|
</DIV>
|
||
|
|
||
|
<DIV class="">
|
||
|
<DIV class="stylepoint_body" name="error.errors[].location__body" id="error.errors[].location__body" style="display: none">
|
||
|
<SPAN class="link_button"><A href="?showone=error.errors[].location#error.errors[].location">
|
||
|
link
|
||
|
</A></SPAN>
|
||
|
|
||
|
<p>The location of the error (the interpretation of its value depends on <code>locationType</code>).</p>
|
||
|
<p>Example:</p>
|
||
|
|
||
|
<DIV class="">
|
||
|
<PRE>{
|
||
|
"error":{
|
||
|
"errors": [{"location": ""}]
|
||
|
}
|
||
|
}
|
||
|
</PRE>
|
||
|
</DIV>
|
||
|
|
||
|
</DIV>
|
||
|
</DIV>
|
||
|
|
||
|
</DIV>
|
||
|
|
||
|
<DIV class="">
|
||
|
<H3>
|
||
|
<A name="error.errors[].locationType" id="error.errors[].locationType">error.errors[].locationType</A>
|
||
|
</H3>
|
||
|
<SPAN class="showhide_button" onclick="javascript:ShowHideByName('error.errors[].locationType__body','error.errors[].locationType__button')" name="error.errors[].locationType__button" id="error.errors[].locationType__button">▶</SPAN>
|
||
|
|
||
|
<DIV style="display:inline;" class="">
|
||
|
Property Value Type: string<br>Parent: <code>error.errors</code>
|
||
|
|
||
|
</DIV>
|
||
|
|
||
|
<DIV class="">
|
||
|
<DIV class="stylepoint_body" name="error.errors[].locationType__body" id="error.errors[].locationType__body" style="display: none">
|
||
|
<SPAN class="link_button"><A href="?showone=error.errors[].locationType#error.errors[].locationType">
|
||
|
link
|
||
|
</A></SPAN>
|
||
|
|
||
|
<p>Indicates how the <code>location</code> property should be interpreted.</p>
|
||
|
<p>Example:</p>
|
||
|
|
||
|
<DIV class="">
|
||
|
<PRE>{
|
||
|
"error":{
|
||
|
"errors": [{"locationType": ""}]
|
||
|
}
|
||
|
}
|
||
|
</PRE>
|
||
|
</DIV>
|
||
|
|
||
|
</DIV>
|
||
|
</DIV>
|
||
|
|
||
|
</DIV>
|
||
|
|
||
|
<DIV class="">
|
||
|
<H3>
|
||
|
<A name="error.errors[].extendedHelp" id="error.errors[].extendedHelp">error.errors[].extendedHelp</A>
|
||
|
</H3>
|
||
|
<SPAN class="showhide_button" onclick="javascript:ShowHideByName('error.errors[].extendedHelp__body','error.errors[].extendedHelp__button')" name="error.errors[].extendedHelp__button" id="error.errors[].extendedHelp__button">▶</SPAN>
|
||
|
|
||
|
<DIV style="display:inline;" class="">
|
||
|
Property Value Type: string<br>Parent: <code>error.errors</code>
|
||
|
|
||
|
</DIV>
|
||
|
|
||
|
<DIV class="">
|
||
|
<DIV class="stylepoint_body" name="error.errors[].extendedHelp__body" id="error.errors[].extendedHelp__body" style="display: none">
|
||
|
<SPAN class="link_button"><A href="?showone=error.errors[].extendedHelp#error.errors[].extendedHelp">
|
||
|
link
|
||
|
</A></SPAN>
|
||
|
|
||
|
<p>A URI for a help text that might shed some more light on the error.</p>
|
||
|
<p>Example:</p>
|
||
|
|
||
|
<DIV class="">
|
||
|
<PRE>{
|
||
|
"error":{
|
||
|
"errors": [{"extendedHelper": "http://url.to.more.details.example.com/"}]
|
||
|
}
|
||
|
}
|
||
|
</PRE>
|
||
|
</DIV>
|
||
|
|
||
|
</DIV>
|
||
|
</DIV>
|
||
|
|
||
|
</DIV>
|
||
|
|
||
|
<DIV class="">
|
||
|
<H3>
|
||
|
<A name="error.errors[].sendReport" id="error.errors[].sendReport">error.errors[].sendReport</A>
|
||
|
</H3>
|
||
|
<SPAN class="showhide_button" onclick="javascript:ShowHideByName('error.errors[].sendReport__body','error.errors[].sendReport__button')" name="error.errors[].sendReport__button" id="error.errors[].sendReport__button">▶</SPAN>
|
||
|
|
||
|
<DIV style="display:inline;" class="">
|
||
|
Property Value Type: string<br>Parent: <code>error.errors</code>
|
||
|
|
||
|
</DIV>
|
||
|
|
||
|
<DIV class="">
|
||
|
<DIV class="stylepoint_body" name="error.errors[].sendReport__body" id="error.errors[].sendReport__body" style="display: none">
|
||
|
<SPAN class="link_button"><A href="?showone=error.errors[].sendReport#error.errors[].sendReport">
|
||
|
link
|
||
|
</A></SPAN>
|
||
|
|
||
|
<p>A URI for a report form used by the service to collect data about the error condition. This URI should be preloaded with parameters describing the request.</p>
|
||
|
<p>Example:</p>
|
||
|
|
||
|
<DIV class="">
|
||
|
<PRE>{
|
||
|
"error":{
|
||
|
"errors": [{"sendReport": "http://report.example.com/"}]
|
||
|
}
|
||
|
}
|
||
|
</PRE>
|
||
|
</DIV>
|
||
|
|
||
|
</DIV>
|
||
|
</DIV>
|
||
|
|
||
|
</DIV>
|
||
|
|
||
|
</DIV>
|
||
|
|
||
|
<DIV class="">
|
||
|
<H2 name="Property_Ordering" id="Property_Ordering">Property Ordering</H2>
|
||
|
|
||
|
<p>Properties can be in any order within the JSON object. However, in some cases the ordering of properties can help parsers quickly interpret data and lead to better performance. One example is a pull parser in a mobile environment, where performance and memory are critical, and unnecessary parsing should be avoided.</p>
|
||
|
|
||
|
<DIV class="">
|
||
|
<H3>
|
||
|
<A name="Kind_Property" id="Kind_Property">Kind Property</A>
|
||
|
</H3>
|
||
|
<SPAN class="showhide_button" onclick="javascript:ShowHideByName('Kind_Property__body','Kind_Property__button')" name="Kind_Property__button" id="Kind_Property__button">▶</SPAN>
|
||
|
|
||
|
<DIV style="display:inline;" class="">
|
||
|
|
||
|
<code>kind</code> should be the first property
|
||
|
</DIV>
|
||
|
|
||
|
<DIV class="">
|
||
|
<DIV class="stylepoint_body" name="Kind_Property__body" id="Kind_Property__body" style="display: none">
|
||
|
<SPAN class="link_button"><A href="?showone=Kind_Property#Kind_Property">
|
||
|
link
|
||
|
</A></SPAN>
|
||
|
|
||
|
<p>Suppose a parser is responsible for parsing a raw JSON stream into a specific object. The "kind" property guides the parser to instantiate the appropriate object. Therefore it should be the first property in the JSON object. This only applies when objects have a "kind" property (usually found in the "data" and "items" properties).</p>
|
||
|
|
||
|
</DIV>
|
||
|
</DIV>
|
||
|
|
||
|
</DIV>
|
||
|
|
||
|
<DIV class="">
|
||
|
<H3>
|
||
|
<A name="Items_Property" id="Items_Property">Items Property</A>
|
||
|
</H3>
|
||
|
<SPAN class="showhide_button" onclick="javascript:ShowHideByName('Items_Property__body','Items_Property__button')" name="Items_Property__button" id="Items_Property__button">▶</SPAN>
|
||
|
|
||
|
<DIV style="display:inline;" class="">
|
||
|
|
||
|
<code>items</code> should be the last property in the "data" object
|
||
|
</DIV>
|
||
|
|
||
|
<DIV class="">
|
||
|
<DIV class="stylepoint_body" name="Items_Property__body" id="Items_Property__body" style="display: none">
|
||
|
<SPAN class="link_button"><A href="?showone=Items_Property#Items_Property">
|
||
|
link
|
||
|
</A></SPAN>
|
||
|
|
||
|
<p>This allows all of the collection's properties to be read before reading each individual item. In cases where there are a lot of items, this avoids unnecessarily parsing those items when the developer only needs fields from the data.</p>
|
||
|
|
||
|
</DIV>
|
||
|
</DIV>
|
||
|
|
||
|
</DIV>
|
||
|
|
||
|
<DIV class="">
|
||
|
<H3>
|
||
|
<A name="Property_Ordering_Example" id="Property_Ordering_Example">Property Ordering Example</A>
|
||
|
</H3>
|
||
|
<SPAN class="showhide_button" onclick="javascript:ShowHideByName('Property_Ordering_Example__body','Property_Ordering_Example__button')" name="Property_Ordering_Example__button" id="Property_Ordering_Example__button">▶</SPAN>
|
||
|
|
||
|
<DIV class="">
|
||
|
<DIV class="stylepoint_body" name="Property_Ordering_Example__body" id="Property_Ordering_Example__body" style="display: none">
|
||
|
<SPAN class="link_button"><A href="?showone=Property_Ordering_Example#Property_Ordering_Example">
|
||
|
link
|
||
|
</A></SPAN>
|
||
|
|
||
|
<DIV class="">
|
||
|
<PRE>// The "kind" property distinguishes between an "album" and a "photo".
|
||
|
// "Kind" is always the first property in its parent object.
|
||
|
// The "items" property is the last property in the "data" object.
|
||
|
{
|
||
|
"data" : {
|
||
|
"kind" : "album",
|
||
|
"title" : "My Photo Album",
|
||
|
"description" : "An album in the user's account",
|
||
|
"items" : [
|
||
|
{
|
||
|
"kind" : "photo",
|
||
|
"title" : "My First Photo"
|
||
|
}
|
||
|
]
|
||
|
}
|
||
|
}
|
||
|
</PRE>
|
||
|
</DIV>
|
||
|
|
||
|
</DIV>
|
||
|
</DIV>
|
||
|
|
||
|
</DIV>
|
||
|
|
||
|
</DIV>
|
||
|
|
||
|
<DIV class="">
|
||
|
<H2 name="Examples" id="Examples">Examples</H2>
|
||
|
|
||
|
<DIV class="">
|
||
|
<H3>
|
||
|
<A name="YouTube_JSON_API" id="YouTube_JSON_API">YouTube JSON API</A>
|
||
|
</H3>
|
||
|
<SPAN class="showhide_button" onclick="javascript:ShowHideByName('YouTube_JSON_API__body','YouTube_JSON_API__button')" name="YouTube_JSON_API__button" id="YouTube_JSON_API__button">▶</SPAN>
|
||
|
|
||
|
<DIV style="display:inline;" class="">
|
||
|
Here's an example of the YouTube JSON API's response object.
|
||
|
</DIV>
|
||
|
|
||
|
<DIV class="">
|
||
|
<DIV class="stylepoint_body" name="YouTube_JSON_API__body" id="YouTube_JSON_API__body" style="display: none">
|
||
|
<SPAN class="link_button"><A href="?showone=YouTube_JSON_API#YouTube_JSON_API">
|
||
|
link
|
||
|
</A></SPAN>
|
||
|
|
||
|
<DIV class="">
|
||
|
<PRE>{
|
||
|
"apiVersion": "2.0",
|
||
|
"data": {
|
||
|
"updated": "2010-02-04T19:29:54.001Z",
|
||
|
"totalItems": 6741,
|
||
|
"startIndex": 1,
|
||
|
"itemsPerPage": 1,
|
||
|
"items": [
|
||
|
{
|
||
|
"id": "BGODurRfVv4",
|
||
|
"uploaded": "2009-11-17T20:10:06.000Z",
|
||
|
"updated": "2010-02-04T06:25:57.000Z",
|
||
|
"uploader": "docchat",
|
||
|
"category": "Animals",
|
||
|
"title": "From service dog to SURFice dog",
|
||
|
"description": "Surf dog Ricochets inspirational video ...",
|
||
|
"tags": [
|
||
|
"Surf dog",
|
||
|
"dog surfing",
|
||
|
"dog",
|
||
|
"golden retriever",
|
||
|
],
|
||
|
"thumbnail": {
|
||
|
"default": "http://i.ytimg.com/vi/BGODurRfVv4/default.jpg",
|
||
|
"hqDefault": "http://i.ytimg.com/vi/BGODurRfVv4/hqdefault.jpg"
|
||
|
},
|
||
|
"player": {
|
||
|
"default": "http://www.youtube.com/watch?v=BGODurRfVv4&feature=youtube_gdata",
|
||
|
"mobile": "http://m.youtube.com/details?v=BGODurRfVv4"
|
||
|
},
|
||
|
"content": {
|
||
|
"1": "rtsp://v5.cache6.c.youtube.com/CiILENy73wIaGQn-Vl-0uoNjBBMYDSANFEgGUgZ2aWRlb3MM/0/0/0/video.3gp",
|
||
|
"5": "http://www.youtube.com/v/BGODurRfVv4?f=videos&app=youtube_gdata",
|
||
|
"6": "rtsp://v7.cache7.c.youtube.com/CiILENy73wIaGQn-Vl-0uoNjBBMYESARFEgGUgZ2aWRlb3MM/0/0/0/video.3gp"
|
||
|
},
|
||
|
"duration": 315,
|
||
|
"rating": 4.96,
|
||
|
"ratingCount": 2043,
|
||
|
"viewCount": 1781691,
|
||
|
"favoriteCount": 3363,
|
||
|
"commentCount": 1007,
|
||
|
"commentsAllowed": true
|
||
|
}
|
||
|
]
|
||
|
}
|
||
|
}
|
||
|
</PRE>
|
||
|
</DIV>
|
||
|
|
||
|
</DIV>
|
||
|
</DIV>
|
||
|
|
||
|
</DIV>
|
||
|
|
||
|
<DIV class="">
|
||
|
<H3>
|
||
|
<A name="Paging_Example" id="Paging_Example">Paging Example</A>
|
||
|
</H3>
|
||
|
<SPAN class="showhide_button" onclick="javascript:ShowHideByName('Paging_Example__body','Paging_Example__button')" name="Paging_Example__button" id="Paging_Example__button">▶</SPAN>
|
||
|
|
||
|
<DIV style="display:inline;" class="">
|
||
|
This example demonstrates how the Google search items could be represented as a JSON object, with special attention to the paging variables.
|
||
|
</DIV>
|
||
|
|
||
|
<DIV class="">
|
||
|
<DIV class="stylepoint_body" name="Paging_Example__body" id="Paging_Example__body" style="display: none">
|
||
|
<SPAN class="link_button"><A href="?showone=Paging_Example#Paging_Example">
|
||
|
link
|
||
|
</A></SPAN>
|
||
|
|
||
|
<p>This sample is for illustrative purposes only. The API below does not actually exist.</p>
|
||
|
<p>Here's a sample Google search results page:<br>
|
||
|
<img src="jsoncstyleguide_example_01.png"><br>
|
||
|
<img src="jsoncstyleguide_example_02.png"></p>
|
||
|
<p>Here's a sample JSON representation of this page:</p>
|
||
|
|
||
|
<DIV class="">
|
||
|
<PRE>{
|
||
|
"apiVersion" : "2.1",
|
||
|
"id" : "1",
|
||
|
"data" : {
|
||
|
"query" : "chicago style pizza",
|
||
|
"time" : "0.1",
|
||
|
"currentItemCount" : 10,
|
||
|
"itemsPerPage" : 10,
|
||
|
"startIndex" : 11,
|
||
|
"totalItems" : 2700000,
|
||
|
"nextLink" : "http://www.google.com/search?hl=en&q=chicago+style+pizza&start=20&sa=N"
|
||
|
"previousLink" : "http://www.google.com/search?hl=en&q=chicago+style+pizza&start=0&sa=N",
|
||
|
"pagingLinkTemplate" : "http://www.google.com/search/hl=en&q=chicago+style+pizza&start={index}&sa=N",
|
||
|
"items" : [
|
||
|
{
|
||
|
"title" : "Pizz'a Chicago Home Page"
|
||
|
// More fields for the search results
|
||
|
}
|
||
|
// More search results
|
||
|
]
|
||
|
}
|
||
|
}
|
||
|
</PRE>
|
||
|
</DIV>
|
||
|
|
||
|
<p>Here's how each of the colored boxes from the screenshot would be represented (the background colors correspond to the colors in the images above):</p>
|
||
|
<ul>
|
||
|
<li>Results <span style="background-color:rgb(180, 167, 214)">11</span> - 20 of about 2,700,000 = startIndex</li>
|
||
|
<li>Results 11 - <span style="background-color:rgb(255, 217, 102)">20</span> of about 2,700,000 = startIndex + currentItemCount - 1</li>
|
||
|
<li>Results 11 - 20 of about <span style="background-color:rgb(246, 178, 107)">2,700,000</span> = totalItems</li>
|
||
|
<li>
|
||
|
<span style="background-color:rgb(234, 153, 153)">Search results</span> = items (formatted appropriately)</li>
|
||
|
<li>
|
||
|
<span style="background-color:rgb(182, 215, 168)">Previous/Next</span> = previousLink / nextLink</li>
|
||
|
<li>
|
||
|
<span style="background-color:rgb(159, 197, 232)">Numbered links in "Gooooooooooogle"</span> = Derived from "pageLinkTemplate". The developer is responsible for calculating the values for {index} and substituting those values into the "pageLinkTemplate". The pageLinkTemplate's {index} variable is calculated as follows:<ul>
|
||
|
<li>Index #1 = 0 * itemsPerPage = 0</li>
|
||
|
<li>Index #2 = 2 * itemsPerPage = 10</li>
|
||
|
<li>Index #3 = 3 * itemsPerPage = 20</li>
|
||
|
<li>Index #N = N * itemsPerPage</li>
|
||
|
</ul>
|
||
|
</li>
|
||
|
</ul>
|
||
|
|
||
|
</DIV>
|
||
|
</DIV>
|
||
|
|
||
|
</DIV>
|
||
|
|
||
|
</DIV>
|
||
|
|
||
|
<DIV class="">
|
||
|
<H2 name="Appendix" id="Appendix">Appendix</H2>
|
||
|
|
||
|
<DIV class="">
|
||
|
<H3>
|
||
|
<A name="Appendix_A:_Reserved_JavaScript_Words" id="Appendix_A:_Reserved_JavaScript_Words">Appendix A: Reserved JavaScript Words</A>
|
||
|
</H3>
|
||
|
<SPAN class="showhide_button" onclick="javascript:ShowHideByName('Appendix_A:_Reserved_JavaScript_Words__body','Appendix_A:_Reserved_JavaScript_Words__button')" name="Appendix_A:_Reserved_JavaScript_Words__button" id="Appendix_A:_Reserved_JavaScript_Words__button">▶</SPAN>
|
||
|
|
||
|
<DIV style="display:inline;" class="">
|
||
|
A list of reserved JavaScript words that should be avoided in property names.
|
||
|
</DIV>
|
||
|
|
||
|
<DIV class="">
|
||
|
<DIV class="stylepoint_body" name="Appendix_A:_Reserved_JavaScript_Words__body" id="Appendix_A:_Reserved_JavaScript_Words__body" style="display: none">
|
||
|
<SPAN class="link_button"><A href="?showone=Appendix_A:_Reserved_JavaScript_Words#Appendix_A:_Reserved_JavaScript_Words">
|
||
|
link
|
||
|
</A></SPAN>
|
||
|
|
||
|
<p>The words below are reserved by the JavaScript language and cannot be referred to using dot notation. The list represents best knowledge of keywords at this time; the list may change or vary based on your specific execution environment.</p>
|
||
|
<p>From the <a href="http://www.google.com/url?sa=D&q=http%3A%2F%2Fwww.ecma-international.org%2Fpublications%2Fstandards%2FEcma-262.htm">ECMAScript Language Specification 5th Edition</a>
|
||
|
</p>
|
||
|
|
||
|
<DIV class="">
|
||
|
<PRE>abstract
|
||
|
boolean break byte
|
||
|
case catch char class const continue
|
||
|
debugger default delete do double
|
||
|
else enum export extends
|
||
|
false final finally float for function
|
||
|
goto
|
||
|
if implements import in instanceof int interface
|
||
|
let long
|
||
|
native new null
|
||
|
package private protected public
|
||
|
return
|
||
|
short static super switch synchronized
|
||
|
this throw throws transient true try typeof
|
||
|
var volatile void
|
||
|
while with
|
||
|
yield</PRE>
|
||
|
</DIV>
|
||
|
|
||
|
</DIV>
|
||
|
</DIV>
|
||
|
|
||
|
</DIV>
|
||
|
|
||
|
</DIV>
|
||
|
|
||
|
<HR>
|
||
|
|
||
|
|
||
|
<p align="right">
|
||
|
Revision 0.9
|
||
|
</p>
|
||
|
|
||
|
|
||
|
<address>
|
||
|
|
||
|
</address>
|
||
|
|
||
|
|
||
|
</BODY>
|
||
|
</HTML>
|