Skip to main content
Commonmark migration
Source Link

##Soapi.JS Usage Introduction

Soapi.JS Usage Introduction

To use Soapi.JS, simply include soapi.js in your document.

e.g.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
    <script src="scripts/Soapi.js" type="text/javascript"></script>
    <!-- the rest of your document -->

Soapi.JS is designed to be very simple to use. The only 'class' you will instantiate is RouteFactory.

RouteFactory

The RouteFactory requires 2 parameters:

  • targetSite (Required) - the full name of the API you wish to query. e.g. api.stackoverflow.com or http://api.stackoverflow.com
  • apiKey (Optional) - your application's registered apiKey. If you have no api key, API queries will be limited to 300 (or the latest limit) and requests will fail upon usage of that threshold. The JSONP mechanism provides no ability to access response headers and subsequently the x-rate-limit headers that provide usage metrics, so you will simply need to watch for timeouts and respond accordingly.

RouteFactory's raison d'être is to hold a reference to the target site and the api key and build Route objects via factory methods. NOTE: you do not have to, although you may, use the new keyword when instantiating a RouteFactory.

Soapi.RouteFactory('api.stackapps.com', 'api key if you gots one')
.UsersById(14)
.getResponse(function(data) {
    alert(data.items[0].display_name);
});

Next: Routes: what are they and how to use them

##Soapi.JS Usage Introduction

To use Soapi.JS, simply include soapi.js in your document.

e.g.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
    <script src="scripts/Soapi.js" type="text/javascript"></script>
    <!-- the rest of your document -->

Soapi.JS is designed to be very simple to use. The only 'class' you will instantiate is RouteFactory.

RouteFactory

The RouteFactory requires 2 parameters:

  • targetSite (Required) - the full name of the API you wish to query. e.g. api.stackoverflow.com or http://api.stackoverflow.com
  • apiKey (Optional) - your application's registered apiKey. If you have no api key, API queries will be limited to 300 (or the latest limit) and requests will fail upon usage of that threshold. The JSONP mechanism provides no ability to access response headers and subsequently the x-rate-limit headers that provide usage metrics, so you will simply need to watch for timeouts and respond accordingly.

RouteFactory's raison d'être is to hold a reference to the target site and the api key and build Route objects via factory methods. NOTE: you do not have to, although you may, use the new keyword when instantiating a RouteFactory.

Soapi.RouteFactory('api.stackapps.com', 'api key if you gots one')
.UsersById(14)
.getResponse(function(data) {
    alert(data.items[0].display_name);
});

Next: Routes: what are they and how to use them

Soapi.JS Usage Introduction

To use Soapi.JS, simply include soapi.js in your document.

e.g.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
    <script src="scripts/Soapi.js" type="text/javascript"></script>
    <!-- the rest of your document -->

Soapi.JS is designed to be very simple to use. The only 'class' you will instantiate is RouteFactory.

RouteFactory

The RouteFactory requires 2 parameters:

  • targetSite (Required) - the full name of the API you wish to query. e.g. api.stackoverflow.com or http://api.stackoverflow.com
  • apiKey (Optional) - your application's registered apiKey. If you have no api key, API queries will be limited to 300 (or the latest limit) and requests will fail upon usage of that threshold. The JSONP mechanism provides no ability to access response headers and subsequently the x-rate-limit headers that provide usage metrics, so you will simply need to watch for timeouts and respond accordingly.

RouteFactory's raison d'être is to hold a reference to the target site and the api key and build Route objects via factory methods. NOTE: you do not have to, although you may, use the new keyword when instantiating a RouteFactory.

Soapi.RouteFactory('api.stackapps.com', 'api key if you gots one')
.UsersById(14)
.getResponse(function(data) {
    alert(data.items[0].display_name);
});

Next: Routes: what are they and how to use them

replaced http://stackapps.com/ with https://stackapps.com/
Source Link

##Soapi.JS Usage Introduction

To use Soapi.JS, simply include soapi.js in your document.

e.g.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
    <script src="scripts/Soapi.js" type="text/javascript"></script>
    <!-- the rest of your document -->

Soapi.JS is designed to be very simple to use. The only 'class' you will instantiate is RouteFactory.

RouteFactory

The RouteFactory requires 2 parameters:

  • targetSite (Required) - the full name of the API you wish to query. e.g. api.stackoverflow.com or http://api.stackoverflow.com
  • apiKey (Optional) - your application's registered apiKey. If you have no api key, API queries will be limited to 300 (or the latest limit) and requests will fail upon usage of that threshold. The JSONP mechanism provides no ability to access response headers and subsequently the x-rate-limit headers that provide usage metrics, so you will simply need to watch for timeouts and respond accordingly.

RouteFactory's raison d'être is to hold a reference to the target site and the api key and build Route objects via factory methods. NOTE: you do not have to, although you may, use the new keyword when instantiating a RouteFactory.

Soapi.RouteFactory('api.stackapps.com', 'api key if you gots one')
.UsersById(14)
.getResponse(function(data) {
    alert(data.items[0].display_name);
});

Next: Routes: what are they and how to use themRoutes: what are they and how to use them

##Soapi.JS Usage Introduction

To use Soapi.JS, simply include soapi.js in your document.

e.g.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
    <script src="scripts/Soapi.js" type="text/javascript"></script>
    <!-- the rest of your document -->

Soapi.JS is designed to be very simple to use. The only 'class' you will instantiate is RouteFactory.

RouteFactory

The RouteFactory requires 2 parameters:

  • targetSite (Required) - the full name of the API you wish to query. e.g. api.stackoverflow.com or http://api.stackoverflow.com
  • apiKey (Optional) - your application's registered apiKey. If you have no api key, API queries will be limited to 300 (or the latest limit) and requests will fail upon usage of that threshold. The JSONP mechanism provides no ability to access response headers and subsequently the x-rate-limit headers that provide usage metrics, so you will simply need to watch for timeouts and respond accordingly.

RouteFactory's raison d'être is to hold a reference to the target site and the api key and build Route objects via factory methods. NOTE: you do not have to, although you may, use the new keyword when instantiating a RouteFactory.

Soapi.RouteFactory('api.stackapps.com', 'api key if you gots one')
.UsersById(14)
.getResponse(function(data) {
    alert(data.items[0].display_name);
});

Next: Routes: what are they and how to use them

##Soapi.JS Usage Introduction

To use Soapi.JS, simply include soapi.js in your document.

e.g.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
    <script src="scripts/Soapi.js" type="text/javascript"></script>
    <!-- the rest of your document -->

Soapi.JS is designed to be very simple to use. The only 'class' you will instantiate is RouteFactory.

RouteFactory

The RouteFactory requires 2 parameters:

  • targetSite (Required) - the full name of the API you wish to query. e.g. api.stackoverflow.com or http://api.stackoverflow.com
  • apiKey (Optional) - your application's registered apiKey. If you have no api key, API queries will be limited to 300 (or the latest limit) and requests will fail upon usage of that threshold. The JSONP mechanism provides no ability to access response headers and subsequently the x-rate-limit headers that provide usage metrics, so you will simply need to watch for timeouts and respond accordingly.

RouteFactory's raison d'être is to hold a reference to the target site and the api key and build Route objects via factory methods. NOTE: you do not have to, although you may, use the new keyword when instantiating a RouteFactory.

Soapi.RouteFactory('api.stackapps.com', 'api key if you gots one')
.UsersById(14)
.getResponse(function(data) {
    alert(data.items[0].display_name);
});

Next: Routes: what are they and how to use them

updated code samples to rc2.2
Source Link
Sky Sanders
  • 12.1k
  • 3
  • 32
  • 60

##Soapi.JS Usage Introduction

To use Soapi.JS, simply include soapi.js in your document.

e.g.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
    <script src="scripts/Soapi.js" type="text/javascript"></script>
    <!-- the rest of your document -->

Soapi.JS is designed to be very simple to use. The only 'class' you will instantiate is RouteFactory.

RouteFactory

The RouteFactory constructor requires 2 parameters:

  • targetSite (Required) - the full name of the API you wish to query. e.g. api.stackoverflow.com or http://api.stackoverflow.com
  • apiKey (Optional) - your application's registered apiKey. If you have no api key, API queries will be limited to 300 (or the latest limit) and requests will fail upon usage of that threshold. The JSONP mechanism provides no ability to access response headers and subsequently the x-rate-limit headers that provide usage metrics, so you will simply need to watch for timeouts and respond accordingly.

RouteFactory's raison d'être is to hold a reference to the target site and the api key and build Route objects via factory methods. NOTE: you do not have to, although you may, use the new keyword when instantiating a RouteFactory.

new Soapi.RouteFactory('api.stackapps.com', 'api key if you gots one')
.UsersById(14)
.getResponse(function(data) {
    alert(data.users[0]items[0].display_name);
});

Next: Routes: what are they and how to use them

##Soapi.JS Usage Introduction

To use Soapi.JS, simply include soapi.js in your document.

e.g.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
    <script src="scripts/Soapi.js" type="text/javascript"></script>
    <!-- the rest of your document -->

Soapi.JS is designed to be very simple to use. The only 'class' you will instantiate is RouteFactory.

RouteFactory

The RouteFactory constructor requires 2 parameters:

  • targetSite (Required) - the full name of the API you wish to query. e.g. api.stackoverflow.com or http://api.stackoverflow.com
  • apiKey (Optional) - your application's registered apiKey. If you have no api key, API queries will be limited to 300 (or the latest limit) and requests will fail upon usage of that threshold. The JSONP mechanism provides no ability to access response headers and subsequently the x-rate-limit headers that provide usage metrics, so you will simply need to watch for timeouts and respond accordingly.

RouteFactory's raison d'être is to hold a reference to the target site and the api key and build Route objects via factory methods.

new Soapi.RouteFactory('api.stackapps.com', 'api key if you gots one')
.UsersById(14)
.getResponse(function(data) {
    alert(data.users[0].display_name);
});

Next: Routes: what are they and how to use them

##Soapi.JS Usage Introduction

To use Soapi.JS, simply include soapi.js in your document.

e.g.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
    <script src="scripts/Soapi.js" type="text/javascript"></script>
    <!-- the rest of your document -->

Soapi.JS is designed to be very simple to use. The only 'class' you will instantiate is RouteFactory.

RouteFactory

The RouteFactory requires 2 parameters:

  • targetSite (Required) - the full name of the API you wish to query. e.g. api.stackoverflow.com or http://api.stackoverflow.com
  • apiKey (Optional) - your application's registered apiKey. If you have no api key, API queries will be limited to 300 (or the latest limit) and requests will fail upon usage of that threshold. The JSONP mechanism provides no ability to access response headers and subsequently the x-rate-limit headers that provide usage metrics, so you will simply need to watch for timeouts and respond accordingly.

RouteFactory's raison d'être is to hold a reference to the target site and the api key and build Route objects via factory methods. NOTE: you do not have to, although you may, use the new keyword when instantiating a RouteFactory.

Soapi.RouteFactory('api.stackapps.com', 'api key if you gots one')
.UsersById(14)
.getResponse(function(data) {
    alert(data.items[0].display_name);
});

Next: Routes: what are they and how to use them

added 117 characters in body
Source Link
Sky Sanders
  • 12.1k
  • 3
  • 32
  • 60
Loading
deleted 1288 characters in body; added 2 characters in body
Source Link
Sky Sanders
  • 12.1k
  • 3
  • 32
  • 60
Loading
Source Link
Sky Sanders
  • 12.1k
  • 3
  • 32
  • 60
Loading