Skip to content

Instantly share code, notes, and snippets.

@phuongtailtranminh
Last active February 25, 2024 14:31
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save phuongtailtranminh/a4c31bca85d16d9d2bd44ebb34b0de3d to your computer and use it in GitHub Desktop.
Save phuongtailtranminh/a4c31bca85d16d9d2bd44ebb34b0de3d to your computer and use it in GitHub Desktop.
Json Response Format Example
* Use Json Web Token (JWT) for authorization [https://jwt.io/]
- Flickr
Request Format: GET or POST [https://www.flickr.com/services/api/request.rest.html]
Successful Responses:
{
"stat": "ok",
"blogs": {
"blog": [
{
"id": "73",
"name": "Bloxus test",
"needspassword": "0",
"url": "http://remote.bloxus.com/"
},
{
"id": "74",
"name": "Manila Test",
"needspassword": "1",
"url": "http://flickrtest1.userland.com/"
}
]
}
}
Failure Responses:
{
"stat" : "fail",
"code" : "97",
"message" : "Missing signature"
}
- Google:
{
"responseData": {
"query": "Official Google Blogs",
"entries": [
{
"url": "http://googleblog.blogspot.com/feeds/posts/default",
"title": "\u003cb\u003eOfficial Google Blog\u003c/b\u003e",
"contentSnippet": "Jun 24, 2010 \u003cb\u003e...\u003c/b\u003e \u003cb\u003eOfficial\u003c/b\u003e weblog, with news of new products, events and glimpses of life inside \u003cbr\u003e \u003cb\u003eGoogle\u003c/b\u003e.",
"link": "http://googleblog.blogspot.com/"
},
{
"url": "http://googlepress.blogspot.com/feeds/posts/default",
"title": "\u003cb\u003eGoogle Blog\u003c/b\u003e Directory",
"contentSnippet": "\u003cb\u003eGoogle Blog\u003c/b\u003e Directory About our \u003cb\u003eblogs\u003c/b\u003e. Whether it\u0026#39;s a product or feature launch \u003cbr\u003e or a cool new \u003cb\u003e...\u003c/b\u003e \u003cb\u003eBlogs\u003c/b\u003e by Category. \u003cb\u003eGoogle\u003c/b\u003e-wide. Products. Ads. Developer \u003cb\u003e...\u003c/b\u003e",
"link": "http://www.google.com/press/blogs/directory.html"
},
{
"url": "http://blog.google.org/feeds/posts/default",
"title": "\u003cb\u003eOfficial google\u003c/b\u003e.org \u003cb\u003eBlog\u003c/b\u003e",
"contentSnippet": "We will keep posting updates to the \u003cb\u003eGoogle\u003c/b\u003e China \u003cb\u003eblog\u003c/b\u003e as more information and \u003cbr\u003e tools become available. Please visit this page for updated resources. \u003cb\u003e...\u003c/b\u003e",
"link": "http://blog.google.org/"
},
{
"url": "http://blog.google.org/feeds/posts/default",
"title": "\u003cb\u003eOfficial google\u003c/b\u003e.org \u003cb\u003eBlog\u003c/b\u003e: Seeing the forest through the cloud",
"contentSnippet": "Dec 10, 2009 \u003cb\u003e...\u003c/b\u003e For example, in \u003cb\u003eGoogle\u003c/b\u003e Earth today, you can fly to Rondonia, Brazil and easily \u003cbr\u003e observe the advancement of deforestation over time, \u003cb\u003e...\u003c/b\u003e",
"link": "http://blog.google.org/2009/12/seeing-forest-through-cloud.html"
},
{
"url": "http://googlewebmastercentral.blogspot.com/feeds/posts/default",
"title": "\u003cb\u003eOfficial Google\u003c/b\u003e Webmaster Central \u003cb\u003eBlog\u003c/b\u003e",
"contentSnippet": "Jun 21, 2010 \u003cb\u003e...\u003c/b\u003e The \u003cb\u003eofficial\u003c/b\u003e weblog on \u003cb\u003eGoogle\u003c/b\u003e crawling and indexing, and on webmaster tools, \u003cbr\u003e including the Sitemaps facility.",
"link": "http://googlewebmastercentral.blogspot.com/"
},
{
"url": "http://googledocs.blogspot.com/feeds/posts/default",
"title": "\u003cb\u003eOfficial Google\u003c/b\u003e Docs \u003cb\u003eBlog\u003c/b\u003e",
"contentSnippet": "Jun 17, 2010 \u003cb\u003e...\u003c/b\u003e Labels: \u003cb\u003eGoogle\u003c/b\u003e Apps \u003cb\u003eBlog\u003c/b\u003e, sharing. The ability to share my \u003cb\u003eGoogle\u003c/b\u003e Docs is \u003cbr\u003e crucial to my productivity. My teammates and I often add comments \u003cb\u003e...\u003c/b\u003e",
"link": "http://googledocs.blogspot.com/"
},
{
"url": "http://blogoscoped.com/rss.xml",
"title": "\u003cb\u003eGoogle\u0026#39;s Blogs\u003c/b\u003e \u0026#39;n More",
"contentSnippet": "Below posts are mostly from the corporate blogs by Google, Yahoo and Microsoft. \u003cbr\u003e You can also \u0026gt;\u0026gt; Search \u003cb\u003eofficial Google blogs\u003c/b\u003e. \u003cb\u003e...\u003c/b\u003e",
"link": "http://blogoscoped.com/google/"
},
{
"url": "http://googlereader.blogspot.com/feeds/posts/default",
"title": "\u003cb\u003eOfficial Google\u003c/b\u003e Reader \u003cb\u003eBlog\u003c/b\u003e",
"contentSnippet": "Last year we announced that we wanted to hear your wish list for features in \u003cbr\u003e \u003cb\u003eGoogle\u003c/b\u003e Reader, and one of most highly requested features was the ability to \u003cb\u003e...\u003c/b\u003e",
"link": "http://googlereader.blogspot.com/"
},
{
"url": "http://analytics.blogspot.com/feeds/posts/default",
"title": "\u003cb\u003eGoogle\u003c/b\u003e Analytics \u003cb\u003eBlog\u003c/b\u003e",
"contentSnippet": "\u003cb\u003eOfficial\u003c/b\u003e weblog offering news, tips and resources related to \u003cb\u003eGoogle\u0026#39;s\u003c/b\u003e web \u003cbr\u003e traffic analytics service.",
"link": "http://analytics.blogspot.com/"
},
{
"url": "http://feeds.feedburner.com/search-engines-news",
"title": "\u003cb\u003eOfficial Google\u0026#39;s Blogs\u003c/b\u003e List",
"contentSnippet": "Oct 24, 2005 \u003cb\u003e...\u003c/b\u003e \u003cb\u003eOfficial Google\u0026#39;s Blogs\u003c/b\u003e List - Search Engines News.",
"link": "http://www.prweaver.com/blog/2005/10/24/180-official-google-blogs-list"
}
]
},
"responseDetails": null,
"responseStatus": 200
}
- Facebook:
{
"stat": "ok",
"profile": {
"providerName": "Facebook",
"identifier": "http://www.facebook.com/profile.php?id=100BlahBlah7767",
"verifiedEmail": "2013-11-22 21:01:09.601637 +0000",
"preferredUsername": "RpxDoc",
"displayName": "Rpx Doc",
"name": {
"formatted": "Rpx Doc",
"givenName": "Rpx",
"familyName": "Doc"
},
"email": "rpxdoc@yahoo.com",
"url": "http://www.facebook.com/rpx.doc",
"photo": "https://graph.facebook.com/100BlahBlah7767/picture?type=large",
"utcOffset":"-08:00",
"address": {
"formatted": "Portland, Oregon",
"type": "currentLocation"
},
"birthday": "1994-05-19",
"gender": "female"
},
"merged_poco": {
"id": "http://www.facebook.com/profile.php?id=100BlahBlah7767",
"displayName": "Rpx Doc",
"preferredUsername": "RpxDoc",
"gender": "female",
"aboutMe": "i test stuff",
"profileUrl": "http://www.facebook.com/rpx.doc",
"relationshipStatus": "Widowed",
"religion": "u0627u0644u0627u0633u0644u0627u0645",
"status": "set_status timestamp test: Wed, 17 Oct 12 21:36:34 +0000",
"currentLocation": {
"formatted": "Portland, Oregon"
},
"politicalViews": "Bude mu00edt toto vejce vu00edce fanouu0161ku016f neu017e Jiu0159u00ed Paroubek ?",
"name": {
"formatted": "Rpx Doc",
"givenName": "Rpx",
"familyName": "Doc"
},
"updated": "2012-09-13T00:44:03.000Z",
"birthday": "1994-05-19",
"utcOffset":"-08:00",
"emails": [
{
"value": "rpxdoc@yahoo.com",
"type": "other",
"primary": true
}
],
"languagesSpoken": [
"Pig Latin"
],
"urls": [
{
"value": "http://www.facebook.com/rpx.doc",
"type": "profile"
},
{
"value": "http://www.facepalm.org",
"type": "other"
},
{
"value": "http://foo.com",
"type": "other"
}
],
"addresses": [
{
"formatted": "Portland, Oregon",
"type": "currentLocation"
},
{
"formatted": "Luxembourg",
"type": "hometown"
}
],
"books": [
"Dr. Seuss' The Cat in the Hat",
"Good Omens"
],
"movies": [
"Gigli",
"Big Trouble in Little China"
],
"music": [
"My favorite playlist",
"Country music",
"Western"
],
"tvShows": [
"Voltran",
"American Idol",
"ThunderCats",
"Seinfeld"
],
"quotes": [
"I'm getting ENOSPACE writing to /dev/null."
],
"interests": [
"Justin Bieber"
],
"sports": [
"Frolf",
"Underwater hockey"
],
"heroes": [
"Donkey",
"Shrek"
],
"activities": [
"Underwater basket weaving"
],
"photos": [
{
"value": "https://graph.facebook.com/100BlahBlah7767/picture?type=small",
"type": "other"
},
{
"value": "https://graph.facebook.com/100BlahBlah7767/picture?type=large",
"type": "other",
"primary": true
},
{
"value": "https://graph.facebook.com/100BlahBlah7767/picture?type=square",
"type": "other"
},
{
"value": "https://graph.facebook.com/100BlahBlah7767/picture?type=normal",
"type": "other"
}
],
"organizations": [
{
"name": "Janrain",
"title": "Tester",
"type": "job",
"startDate": "2007-05",
"description": "I am."
},
{
"name": "Janrain",
"title": "a wee tester",
"type": "job",
"startDate": "0000-00",
"description": "something clever"
},
{
"name": "Janrain",
"title": "To Test",
"type": "job",
"startDate": "2009-01",
"endDate": "2009-02"
},
{
"name": "Janrain",
"title": "Testing Monkey",
"type": "job",
"startDate": "2006-02",
"endDate": "2005-02",
"description": "I was."
},
{
"name": "School Of Rock",
"type": "High School"
},
{
"name": "Hogwarts School of Witchcraft and Wizardry",
"type": "College"
}
]
},
"friends": [
"http://www.facebook.com/profile.php?id=1234BlahBlah254",
"http://www.facebook.com/profile.php?id=1234BlahBlah434",
"http://www.facebook.com/profile.php?id=1234BlahBlah662"
],
"provider": {
"facebook": {
"albums": [
{
"id": "326BlahBlah6808",
"name": "Untitled Album",
"link": "http://www.facebook.com/album.php?fbid=1234BlahBlah808&id=100BlahBlah7767&aid=78839",
"privacy": "custom",
"type": "normal"
},
{
"id": "326BlahBlah0163",
"name": "Timeline Photos",
"link": "http://www.facebook.com/album.php?fbid=326BlahBlah0163&id=100BlahBlah7767&aid=78838",
"privacy": "everyone",
"type": "wall"
},
{
"id": "322BlahBlah7306",
"name": "Cover Photos",
"link": "http://www.facebook.com/album.php?fbid=322BlahBlah7306&id=100BlahBlah7767&aid=77860",
"privacy": "everyone",
"type": "normal"
},
{
"id": "322BlahBlah1017",
"name": "Untitled Album",
"link": "http://www.facebook.com/album.php?fbid=322BlahBlah1017&id=100BlahBlah7767&aid=77858",
"privacy": "custom",
"type": "normal"
},
{
"id": "102BlahBlah3100",
"name": "Profile Pictures",
"link": "http://www.facebook.com/album.php?fbid=102BlahBlah3100&id=100BlahBlah7767&aid=4035",
"privacy": "everyone",
"type": "profile"
}
],
"games": [
{
"name": "Axis & Allies",
"category": "Interest",
"id": "124BlahBlah6166"
},
{
"name": "UNO",
"category": "Games/toys",
"id": "123BlahBlah6939"
}
],
"groups": [
{
"name": "Test group",
"id": "123BlahBlah2994"
},
{
"name": "Exploratory Group",
"id": "123BlahBlah7259"
}
],
"videos": [
{
"id": "350BlahBlah1104",
"description": "a super awesome movie!!!",
"picture": "http://example.com/hvthumb-ak-snc6/245400_350BlahBlah1061_350BlahBlah1104_2773_417_t.jpg",
"icon": "http://example.com/rsrc.php/v2/yD/r/DggBlahz4tO.gif",
"embed_html": "",
"source": "http://example.com/cfs-ak-ash4/v/34xyz3/743/350BlahBlah1104_8269.mp4?oh=3f74c5a67BlahBlah33eb2d7f72d0dc1&oe=5080CF78&__gda__=1350674533_97d8568b1a07387e4cee5d02d87262b9"
},
{
"id": "123BlahBlah7762",
"description": "what what!",
"picture": "http://example.com/hvthumb-ak-ash4/245318_350BlahBlah4397_350BlahBlah7762_37327_361_t.jpg",
"icon": "http://example.com/rsrc.php/v2/yD/r/DggBlahz4tO.gif",
"embed_html": "",
"source": "http://example.com/cfs-ak-snc7/v/610161/125/350BlahBlah7762_24214.mp4?oh=3f527BlahBlahBlahBlah8dd9c665ba0&oe=5080F026&__gda__=1350Blah08_f3da7404BlahBlah6f886b3fce52ea4a"
}
]
}
},
"limited_data": "false",
"accessCredentials": {
"accessToken": "AAAFArLqJQIBlahBlaha0rCdu9m5d5fBlahBlahFKYWpp401H9LGf5rQasuZAzrMyoZA9J45FDSZACLyNCXkAZAgpDFr0hG8NBkb8CccXXuQZDZD",
"uid": "100BlahBlah7767",
"expires": 1355690751,
"scopes": "email,publish_stream,user_birthday,user_location,user_hometown,user_relationships,user_interests,user_about_me,user_photos,user_work_history,friends_hometown,friends_interests,friends_relationships,friends_photos,friends_location,friends_about_me,friends_birthday,friends_work_history,read_stream,read_insights,create_event,rsvp_event,sms,read_requests,read_mailbox,read_friendlists,xmpp_login,ads_management,manage_pages,user_checkins,friends_checkins,publish_checkins,user_online_presence,friends_online_presence,user_education_history,friends_education_history,user_religion_politics,friends_religion_politics,user_likes,manage_notifications,friends_actions.music,user_actions.music,user_activities,friends_likes,friends_relationship_details,publish_actions,friends_events,user_notes,friends_notes,friends_questions,friends_videos,user_website,friends_status,friends_activities,manage_friendlists,user_events,user_groups,friends_groups,user_questions,user_videos,friends_website",
"type": "Facebook"
}
}
- Atlassian:
Successful Authentication Response:
{
"name" : "my_username",
...
}
Unsuccessful Authentication Response
{
"reason" : "INVALID_USER_AUTHENTICATION",
"message" : "Failed to authenticate principal, password was invalid"
}
- Twitter:
{
"always_use_https": true,
"discoverable_by_email": true,
"geo_enabled": true,
"language": "en",
"protected": false,
"screen_name": "theSeanCook",
"show_all_inline_media": false,
"sleep_time": {
"enabled": false,
"end_time": null,
"start_time": null
},
"time_zone": {
"name": "Pacific Time (US & Canada)",
"tzinfo_name": "America/Los_Angeles",
"utc_offset": -28800
},
"trend_location": [
{
"country": "United States",
"countryCode": "US",
"name": "Atlanta",
"parentid": 23424977,
"placeType": {
"code": 7,
"name": "Town"
},
"url": "http://where.yahooapis.com/v1/place/2357024",
"woeid": 2357024
}
],
"use_cookie_personalization": true,
"allow_contributor_request": "all"
}
- Ebay:
+Always Check the Ack Value in the Response
Each API response contains an acknowledgement field (e.g., ack or Ack), and the value in this field indicates whether the request was successful or not (e.g., <ack>Success</ack>). The value will be one of the following values:
Success
Warning
Failure
PartialFailure
+Both Success and Warning Indicate a Successful Request
Both Success and Warning indicate that the request was successful. However, a value of Warning means that something occurred that may affect your application or the user. For example, eBay may have dropped or changed a value submitted in the request. In this case, eBay returns a normal, successful response and also returns the warning. When a warning occurs, the error is returned in addition to the business data. In this case, you do not need to retry the request (as the original request was successful). Depending on the cause or nature of the warning, you might need to contact either the end user or eBay to effect a long term solution to the problem to prevent it from reoccurring in the future.
+How to Handle Failure
If the source of the problem is within the application (such as a missing required element), please change the application before you retry the request. If the problem is due to end-user input data, please alert the end-user to the problem and provide the means for them to correct the data. Once the problem in the application or data is resolved, you can attempt to re-send the request to eBay. If the source of the problem is on eBay's side, an application can retry the request "as-is" a reasonable number of times (eBay recommends twice). If the error persists, contact Developer Technical Support. Once the problem has been resolved, the request may be resent in its original form.
+How to Handle Partial Failures
An ack value of PartialFailure means that eBay successfully processed the parts of the request, but one or more non-fatal errors occurred during the processing. For best results, requests should return without warning messages. Inspect the message details inside the Error container and resolve any problems before resubmitting the request.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment