• Register
  • Log In
  • Home
  • Quick Start
    • Configurator
    • Download YUI 3
  • Documentation
    • User Guides
    • Examples
    • API Docs
    • Environments
    • Tutorials
  • Community
    • Gallery
    • Blog
    • Forums
    • YUI Theater
    • Calendar
  • Contribute
    • YUI on GitHub »
    • File a Ticket
    • View Tickets
    • Dashboard
  • Other Projects
    • Shifter »
    • Yogi »
    • YUI 2
    • YUI Doc »
    • YUI Test
    • YUI Website
    • YUI Compressor »
    • YUI Builder »
    • YUI PHP Loader
    • Grid Builder »
    • Skin Builder »
  • YUI
  • >
  • Community
  • >
  • Gallery

Gallery

Modules

  • Home
  • Featured
  • Popular
  • New
  • All

Documentation

  • Yogi Documentation
  • Shifter Documentation
  • Developer Guide
  • Module Setup

Tag Cloud

Context Navigation

    YUI Library is not responsible for bugs or support with this module. It is available as a free service. For support please contact the module owner with the provided links.

    YQL REST Client (gallery-yql-rest-client) on cdn

    Last Updated: 06/23/12
    + 0 -

    Steven Olmsted

    YUI Contributor

    See 42 more by this user.

    Created: 01/10/12
    Last CDN Push: 06/20/12
    Build Tag: gallery-2012.06.20-20-07
    Project: YUI 3
    License: YUI BSD
    YUI Version: 3.5.1
    Free for use.

    This is a simple REST client supporting DELETE, GET, HEAD, POST, and PUT.

    • Tags:
    • solmsted
    • rest
    • put
    • post
    • delete
    • client
    • get
    • head
    • yql
    • Download
    • Docs
    • Homepage
    • Bugs
    • Source
    • Example
    • Forum
    • History

    There will probably be some API sugar in the future. For now, there is one method, Y.YQLRESTClient.request, that takes a kitchen sink object, a callback function, a yql params object, and a yql opts object.

    The params and opts object are passed through to Y.YQL, reference the docs there.

    On success, the callback function is passed an object containing headers, url, response, and status.

    The kitchen sink parameters object may have the following members:

    accept - Specifies the type of content to send in the response using the Accept HTTP header. This tells YQL what kind of data format you want returned, as well as how to parse it.

    content - The body content of a POST or PUT request.

    contentType - Specifies the content-type of the body content of a POST or PUT request.

    fallbackCharsets - Overrides the list of fallback character sets, which is set to "utf-8, iso-8859-1" by default, for decoding the returned response. YQL attempts to decode the response using the character sets listed here when the response either does not specify the character set or specifies an incorrect character set that results in a failed decoding. This value may be an array of strings or one string with comma separated values.

    forceCharset - Forces YQL to use the character set specified. Using this overrides both the character set specified by the response and the fallback character sets.

    headers - Adds HTTP headers to the request.

    jsonCompat - Set this value to 'new' to get "lossless" JSON when making a REST call to a Web service. jsonCompat: 'new' must also be set in the yqlParams object.

    matrix - Adds matrix parameters to the request.

    method - The HTTP method to use. Must be one of 'DELETE', 'GET', 'HEAD', 'POST' or 'PUT'.

    paths - Array of paths to append to the url.

    query - Query parameters to add to the request.

    timeout - Specifies the request timeout in milliseconds. This is useful when you want to cancel requests that take longer than expected.

    url - Provides a URL endpoint to query.

    YQL's REST API docs are a good reference too. These parameter values translate directly into API method calls. http://developer.yahoo.com/yql/guide/yql-javascript-objects.html#yql-execute-yrestobject

    Code Sample

    <script src="http://yui.yahooapis.com/3.5.1/build/yui/yui-min.js"></script>
    YUI({
        //Last Gallery Build of this module
        gallery: 'gallery-2012.06.20-20-07'
    }).use('gallery-yql-rest-client', function(Y) {
        Y.YQLRESTClient.request({
            method: 'get',
            url: 'http://www.google.com'
        }, function (result) {
            alert(result.response);
        });
    });

    © 2006-2013 Yahoo! Inc. All rights reserved.
    All code on this site is licensed under the BSD License unless stated otherwise.
    About This Site · Security Contact Info