NAV Navbar
json xml
  • Introduction
  • Authentication
  • Articles
  • Search
  • Errors
  • Introduction

    Welcome to the WebCode.How API! You can use our API to access our articles and site metrics that are available publicly.

    We have language bindings in Shell, Ruby, and JavaScript! You can view code examples in the dark area to the right, and you can switch the programming language of the examples with the tabs in the top right.

    This API documentation page was created with Slate. We at WebCode.How send a giant thank you to the team that built this wonderful tool.

    Authentication

    # If you can, please stay below
    # 15 requests / minute to keep
    # our servers happy, though.
    

    WebCode.How's public API requires no authentication and has no set rate limits.

    Abuse of the API will result in your IP being blocked. Please do NOT perform so many requests that it looks like abuse.

    Articles

    Get All Articles

    {
      "data": [
        {
          "id": 1,
          "content": "In 2008, Google officially released autocomplete and forever...",
          "demoUrl": "http://demo.webcode.how/ajax-autocomplete",
          "excerpt": "Learn how to make a simple AJAX-loading dynamic...",
          "slug": "how-to-make-an-ajax-autocomplete-for-a-search-input",
          "syntax": "javascript",
          "title": "How To Make An Ajax Autocomplete For A Search Input",
          "author": {
            "id": 3,
            "name": "Dean Papastrat",
            "pictureUrl": "http://cdn.webcode.how/3ijofscior.jpg"
          },
          "browser_support": {
            "browsers": [
              {
                "minimumVersion": "21",
                "type": "chrome"
              }
            ],
            "compatibilityTableUrl": "http://caniuse.com/input",
          },
          "demoRepository": {
            "downloadUrl": "https://github.com/WebCode-How/ajax-autocomplete/archive/master.zip",
            "host": "github",
            "name": "ajax-autocomplete",
            "websiteUrl": "https://github.com/WebCode-How/ajax-autocomplete"
          },
          "furtherReadingArticles": [
            {
              "excerpt": "Learn how to make native dropdowns using the new HTML5 datalist element.",
              "permalink": "http://blog.teamtreehouse.com/creating-autocomplete-dropdowns-datalist-element",
              "title": "Creating Autocomplete Dropdowns with the Datalist Element",
              "websiteName": "Treehouse Blog"
            }
          ],
          "prerequisiteArticles": [
            {
              "excerpt": "Learn how to use the HTML input element.",
              "permalink": "http://webcode.how/how-to-make-an-html-input-element",
              "title": "How to Make an Input Element",
              "websiteName": "WebCode.How"
            }
          ]
        }
      ],
      "paging": {
        "next": "http://api.webcode.how/articles?limit=25&until=1364849754"
        "previous": "http://api.webcode.how/articles?limit=25&since=1364587774"
      }
    }
    
    <?xml version="1.0" encoding="utf-8" ?>
    <data>
      <article>
        <id>1</id>
        <content>In 2008, Google officially released autocomplete and forever...</content>
        <demoUrl>http://demo.webcode.how/ajax-autocomplete</demoUrl>
        <excerpt>Learn how to make a simple AJAX-loading dynamic...</excerpt>
        <slug>how-to-make-an-ajax-autocomplete-for-a-search-input</slug>
        <syntax>javascript</syntax>
        <title>How To Make An Ajax Autocomplete For A Search Input</title>
        <author>
          <id>3</id>
          <name>Dean Papastrat</name>
          <pictureUrl>http://cdn.webcode.how/3ijofscior.jpg</pictureUrl>
        </author>
        <browserSupport>
          <browsers>
            <browser>
              <minimumVersion>21</minimumVersion>
              <type>chrome</type>
            </browser>
          </browsers>
          <compatibilityTableUrl>http://caniuse.com/input</compatibilityTableUrl>
        </browserSupport>
        <demoRepository>
          <downloadUrl>https://github.com/WebCode-How/ajax-autocomplete/archive/master.zip</downloadUrl>
          <host>github</host>
          <name>ajax-autocomplete</name>
          <websiteUrl>https://github.com/WebCode-How/ajax-autocomplete</websiteUrl>
        </demoRepository>
        <furtherReadingArticles>
          <condensedArticle>
            <excerpt>Learn how to make native dropdowns using the new HTML5 datalist element.</excerpt>
            <permalink>http://blog.teamtreehouse.com/creating-autocomplete-dropdowns-datalist-element</permalink>
            <title>Creating Autocomplete Dropdowns with the Datalist Element</title>
            <websiteName>Treehouse Blog</websiteName>
          </condensedArticle>
        </furtherReadingArticles>
        <prerequisiteArticles>
          <condensedArticle>
            <excerpt>Learn how to use the HTML input element.</excerpt>
            <permalink>http://webcode.how/how-to-make-an-html-input-element</permalink>
            <title>How to Make an Input Element</title>
            <websiteName>WebCode.How</websiteName>
          </condensedArticle>
        </prerequisiteArticles>
      </article>
    </data>
    <paging>
      <next>http://api.webcode.how/articles?limit=25&until=1364849754</next>
      <previous>http://api.webcode.how/articles?limit=25&since=1364587774</previous>
    </paging>
    

    This endpoint retrieves all articles, ordered by the date they were published.

    HTTP Request

    GET http://api.webcode.how/articles

    URL Parameters

    Parameter Type Default Description
    format String json Format to return; one of: ["json", "xml"]
    limit Integer 25 Number of articles to return, from 1 to 50
    since Unix Timestamp null Unix timestamp all articles returned must be published after
    until Unix Timestamp null Unix timestamp all articles returned must be published before

    Response Model [CursoredData[Article]]

    Field Type Description
    data Array[Article] Array of Article objects; see /articles/ID or Slug. Empty if no articles match.
    paging Paging Contains metadata for paging over articles

    Paging Object

    Field Type Description
    next String[URI] Link to next page of articles. Null if no next page.
    previous String[URI] Link to previous page of articles. Null if no previous page.

    Get An Article

    {
      "id": 1,
      "content": "In 2008, Google officially released autocomplete and forever...",
      "demoUrl": "http://demo.webcode.how/ajax-autocomplete",
      "excerpt": "Learn how to make a simple AJAX-loading dynamic...",
      "permalink": "http://webcode.how/how-to-make-an-ajax-autocomplete-for-a-search-input",
      "slug": "how-to-make-an-ajax-autocomplete-for-a-search-input",
      "syntax": "javascript",
      "title": "How To Make An Ajax Autocomplete For A Search Input",
      "author": {
        "id": 3,
        "name": "Dean Papastrat",
        "pictureUrl": "http://cdn.webcode.how/3ijofscior.jpg"
      },
      "browserSupport": {
        "browsers": [
          {
            "minimumVersion": "21",
            "type": "chrome"
          }
        ],
        "compatibilityTableUrl": "http://caniuse.com/input",
      },
      "demoRepository": {
        "downloadUrl": "https://github.com/WebCode-How/ajax-autocomplete/archive/master.zip",
        "host": "github",
        "name": "ajax-autocomplete",
        "websiteUrl": "https://github.com/WebCode-How/ajax-autocomplete"
      },
      "furtherReadingArticles": [
        {
          "excerpt": "Learn how to make native dropdowns using the new HTML5 datalist element.",
          "permalink": "http://blog.teamtreehouse.com/creating-autocomplete-dropdowns-datalist-element",
          "title": "Creating Autocomplete Dropdowns with the Datalist Element",
          "websiteName": "Treehouse Blog"
        }
      ],
      "prerequisiteArticles": [
        {
          "excerpt": "Learn how to use the HTML input element.",
          "permalink": "http://webcode.how/how-to-make-an-html-input-element",
          "title": "How to Make an Input Element",
          "websiteName": "WebCode.How"
        }
      ]
    }
    
    <?xml version="1.0" encoding="utf-8" ?>
    <article>
      <id>1</id>
      <content>In 2008, Google officially released autocomplete and forever...</content>
      <demoUrl>http://demo.webcode.how/ajax-autocomplete</demoUrl>
      <excerpt>Learn how to make a simple AJAX-loading dynamic...</excerpt>
      <slug>how-to-make-an-ajax-autocomplete-for-a-search-input</slug>
      <syntax>javascript</syntax>
      <title>How To Make An Ajax Autocomplete For A Search Input</title>
      <author>
        <id>3</id>
        <name>Dean Papastrat</name>
        <pictureUrl>http://cdn.webcode.how/3ijofscior.jpg</pictureUrl>
      </author>
      <browserSupport>
        <browsers>
          <browser>
            <minimumVersion>21</minimumVersion>
            <type>chrome</type>
          </browser>
        </browsers>
        <compatibilityTableUrl>http://caniuse.com/input</compatibilityTableUrl>
      </browserSupport>
      <demoRepository>
        <downloadUrl>https://github.com/WebCode-How/ajax-autocomplete/archive/master.zip</downloadUrl>
        <host>github</host>
        <name>ajax-autocomplete</name>
        <websiteUrl>https://github.com/WebCode-How/ajax-autocomplete</websiteUrl>
      </demoRepository>
      <furtherReadingArticles>
        <condensedArticle>
          <excerpt>Learn how to make native dropdowns using the new HTML5 datalist element.</excerpt>
          <permalink>http://blog.teamtreehouse.com/creating-autocomplete-dropdowns-datalist-element</permalink>
          <title>Creating Autocomplete Dropdowns with the Datalist Element</title>
          <websiteName>Treehouse Blog</websiteName>
        </condensedArticle>
      </furtherReadingArticles>
      <prerequisiteArticles>
        <condensedArticle>
          <excerpt>Learn how to use the HTML input element.</excerpt>
          <permalink>http://webcode.how/how-to-make-an-html-input-element</permalink>
          <title>How to Make an Input Element</title>
          <websiteName>WebCode.How</websiteName>
        </condensedArticle>
      </prerequisiteArticles>
    </article>
    

    This endpoint retrieves an article.

    HTTP Request

    GET http://api.webcode.how/articles/<id|slug>

    URL Parameters

    Parameter Type Default Description
    id Integer The ID of the article to retrieve
    format String json Format to return; one of: ["json", "xml"]
    slug String The Slug of the article to retrieve

    Response Model [Article]

    Field Type Description
    id Integer Unique integer representing article
    content String[HTML] Tutorial content of article
    demoUrl String[URI] Link to demo page for article
    excerpt String Under 255 character summary of article
    permalink String[URI] Link to article
    slug String SEO-optimized unique identifier for article, used in permalink
    syntax String Language the article was written for; One of: ["javascript", "coffeescript", "typescript", "jquery"]
    title String Name of article
    author Author Object representing who wrote the article
    browserSupport BrowserSupport Object representing support of browser features used in article
    demoRepository Repository Object representing the repository with sample code for article
    furtherReadingArticles Array[CondensedArticle] Array of articles to read after finishing article
    prerequisiteArticles Array[CondensedArticle] Array of articles indicating prior knowledge needed

    Author Object

    Field Type Description
    id Integer Unique integer representing author
    name String Name of author
    pictureUrl String[URI] Link to a picture of author

    Browser Object

    Field Type Description
    minimumVersion String Min. browser version for support of article's syntax
    type String Unique identifier representing browser

    BrowserSupport Object

    Field Type Description
    browsers Array[Browser] Array of objects representing browsers supported by tutorial
    compatibilityTableUrl String[URI] Link to chart showing support of features used

    CondensedArticle Object

    Field Type Description
    excerpt String Under 255 character summary of article
    permalink String[URI] Link to article
    title String Name of article
    websiteName String Name of the website the article is on

    Repository Object

    Field Type Description
    downloadUrl String[URI] Link to download the repository
    host String Name of the repository host
    name String Name of repository
    websiteUrl String[URI] Link to the webpage for the repository

    Search

    Query WebCode.How

    {
      "data": [
        {
          "description": "Learn how to make a simple AJAX-loading dynamic...",
          "permalink": "http://webcode.how/how-to-make-an-autocomplete-for-a-search-input",
          "title": "How To Make An Ajax Autocomplete For A Search Input",
          "type": "article"
        }
      ],
      "paging": {
        "next": "http://api.webcode.how/search?q=myquery&limit=25&before=10"
        "previous": "http://api.webcode.how/search?q=myquery&limit=25&after=20"
      }
    }
    
    <?xml version="1.0" encoding="utf-8" ?>
    <data>
      <searchItem>
        <description>Learn how to make a simple AJAX-loading dynamic...</description>
        <permalink>http://webcode.how/how-to-make-an-autocomplete-for-a-search-input</permalink>
        <title>How To Make An Ajax Autocomplete For A Search Input</title>
        <type>article</type>
      </searchItem>
    </data>
    <paging>
      <next>http://api.webcode.how/search?q=myquery&limit=25&before=10</next>
      <previous>http://api.webcode.how/search?q=myquery&limit=25&after=20</previous>
    </paging>
    

    This endpoint searches WebCode.How's articles, ordered by relevance. Author support is roadmapped.

    HTTP Request

    GET http://api.webcode.how/search?q=<Slug|ID>

    URL Parameters

    Parameter Type Default Description
    format String json Format to return; one of: ["json", "xml"]
    q String Search string to query for

    Response Model

    Response Model [CursoredData[SearchItem]]

    Field Type Description
    data Array[SearchItem] Array of Search Items
    paging Paging Contains metadata for paging over articles

    Paging Object

    Field Type Description
    next String[URI] Link to next page of articles. Null if no next page.
    previous String[URI] Link to previous page of articles. Null if no previous page.

    Search Item

    Field Type Description
    description String Under 255 character description of search item, such as a bio or excerpt
    title String Under 255 character title of search item
    permalink String[URI] Link to the full resource for search item
    type String Type of result; One of: ["author", "article"]

    Errors

    The WebCode.How API uses the following error codes to give context to why requests failed.

    Please review the codes and try to resolve issues on your own before contacting us. You can check our status page at status.webcode.how to see if there's a larger issue affecting multiple clients.

    Our status page checks all of our endpoints, so you can see if a particular endpoint is having issues.

    Client Errors

    {
      "error": {
        "code": 400,
        "message": "Bad Request: Your request is invalid"
      }
    }
    
    <?xml version="1.0" encoding="utf-8" ?>
    <error>
      <code>400</code>
      <message>Bad Request: Your request is invalid</message>
    </error>
    

    If you get a 400-series error code, it's an issue on your end. Please review documentation on the endpoints you're using as well as your own code before filing an issue.

    Error Code Meaning
    400 Bad Request -- Your request is invalid.
    403 Forbidden -- You are not allowed to access the resource.
    404 Not Found -- Requested object could not be found.
    405 Method Not Allowed
    410 Gone -- Request object has been deleted.
    415 Unsupported Type -- Request not available in the given format.
    418 I'm a Teapot -- Pour yourself some tea over at /teapot.
    429 Too Many Requests -- You have made too many requests in too short of a time.
    451 Blocked for Legal Reasons -- Request object has been denied because of legal issues.

    Server Errors

    {
      "error": {
        "code": 500,
        "message": "Internal Server Error: Could not respond"
      }
    }
    
    <?xml version="1.0" encoding="utf-8" ?>
    <error>
      <code>500</code>
      <message>Internal Server Error: Could not respond</message>
    </error>
    

    If you get a 500-series error code, it's an issue on our end. We review erorr logs frequently and will attempt to resolve them as fast as possible.

    Error Code Meaning
    500 Internal Server Error -- We had a problem with our server. Try again later.
    501 Not Implemented -- This endpoint has not been implemented. Submit a request to info@webcode.how for more info.
    502 Bad Gateway -- Our load balancers are having issues. Please try again with exponential backoff.
    503 Service Unavailable -- Our servers are down. Please try again with exponential backoff.
    504 Timeout -- Our servers are having a hard time keeping up with load. Please try again with exponential backoff.