Skip to main content
Commonmark migration
Source Link

###A: How do I get a question?

A: How do I get a question?

<!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>
    <script src="scripts/Soapi.Generated.js" type="text/javascript"></script>
    <script type="text/javascript">

        function run() {

            var apiKey = '';


            var route = Soapi.RouteFactory('api.stackapps.com', apiKey).QuestionsById(494);
            route.answers = true;
            route.body = true;

            var response = route.getResponse(
            function success(data) {

                alert(data.items[0].title);
            },
            function error(err) {
                alert("Error:" + err.message);
            });


            // or
            Soapi.RouteFactory('api.stackapps.com', apiKey)
            .QuestionsById(494,{
                answers: true,
                body: true
            })
            .getResponse(
            function success(data) {

                alert(data.items[0].title);
            },
            function error(err) {
                alert("Error:" + err.message);
            });
        }
    </script>
</head>
<body onload="run()">
</body>
</html>

###A: How do I get a question?

<!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>
    <script src="scripts/Soapi.Generated.js" type="text/javascript"></script>
    <script type="text/javascript">

        function run() {

            var apiKey = '';


            var route = Soapi.RouteFactory('api.stackapps.com', apiKey).QuestionsById(494);
            route.answers = true;
            route.body = true;

            var response = route.getResponse(
            function success(data) {

                alert(data.items[0].title);
            },
            function error(err) {
                alert("Error:" + err.message);
            });


            // or
            Soapi.RouteFactory('api.stackapps.com', apiKey)
            .QuestionsById(494,{
                answers: true,
                body: true
            })
            .getResponse(
            function success(data) {

                alert(data.items[0].title);
            },
            function error(err) {
                alert("Error:" + err.message);
            });
        }
    </script>
</head>
<body onload="run()">
</body>
</html>

A: How do I get a question?

<!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>
    <script src="scripts/Soapi.Generated.js" type="text/javascript"></script>
    <script type="text/javascript">

        function run() {

            var apiKey = '';


            var route = Soapi.RouteFactory('api.stackapps.com', apiKey).QuestionsById(494);
            route.answers = true;
            route.body = true;

            var response = route.getResponse(
            function success(data) {

                alert(data.items[0].title);
            },
            function error(err) {
                alert("Error:" + err.message);
            });


            // or
            Soapi.RouteFactory('api.stackapps.com', apiKey)
            .QuestionsById(494,{
                answers: true,
                body: true
            })
            .getResponse(
            function success(data) {

                alert(data.items[0].title);
            },
            function error(err) {
                alert("Error:" + err.message);
            });
        }
    </script>
</head>
<body onload="run()">
</body>
</html>
updated code samples to rc2.2
Source Link
Sky Sanders
  • 12.1k
  • 3
  • 32
  • 60

###A: How do I get a question?

<!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>
    <script src="scripts/Soapi.Generated.js" type="text/javascript"></script>
    <script type="text/javascript">

        function run() {

            var apiKey = ''; 


            var factoryroute = new Soapi.RouteFactory('api.stackapps.com', apiKey);

            var route = factory.QuestionsById(494);
            route.answers = true;
            route.body = true;


 

            var response = route.getResponse(
            function success(data) {

                alert(data.questions[0]items[0].title);
            },
            function error(err) {
                alert("Error:" + err.message);
            });


            // or
            factorySoapi.QuestionsByIdRouteFactory(494'api.stackapps.com', apiKey)
            .applyParametersQuestionsById(
            494,{
                answers: true,
                body: true
            })
            .getResponse(
            function success(data) {

                alert(data.questions[0]items[0].title);
            },
            function error(err) {
                alert("Error:" + err.message);
            });
        }
    </script>
</head>
<body onload="run()">
</body>
</html>

###A: How do I get a question?

<!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>
    <script src="scripts/Soapi.Generated.js" type="text/javascript"></script>
    <script type="text/javascript">

        function run() {

            var apiKey = '';
            var factory = new Soapi.RouteFactory('api.stackapps.com', apiKey);

            var route = factory.QuestionsById(494);
            route.answers = true;
            route.body = true;


 

            var response = route.getResponse(
            function success(data) {

                alert(data.questions[0].title);
            },
            function error(err) {
                alert("Error:" + err.message);
            });


            // or
            factory.QuestionsById(494)
            .applyParameters(
            {
                answers: true,
                body: true
            })
            .getResponse(
            function success(data) {

                alert(data.questions[0].title);
            },
            function error(err) {
                alert("Error:" + err.message);
            });
        }
    </script>
</head>
<body onload="run()">
</body>
</html>

###A: How do I get a question?

<!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>
    <script src="scripts/Soapi.Generated.js" type="text/javascript"></script>
    <script type="text/javascript">

        function run() {

            var apiKey = ''; 


            var route = Soapi.RouteFactory('api.stackapps.com', apiKey).QuestionsById(494);
            route.answers = true;
            route.body = true;

            var response = route.getResponse(
            function success(data) {

                alert(data.items[0].title);
            },
            function error(err) {
                alert("Error:" + err.message);
            });


            // or
            Soapi.RouteFactory('api.stackapps.com', apiKey)
            .QuestionsById(494,{
                answers: true,
                body: true
            })
            .getResponse(
            function success(data) {

                alert(data.items[0].title);
            },
            function error(err) {
                alert("Error:" + err.message);
            });
        }
    </script>
</head>
<body onload="run()">
</body>
</html>
Source Link
Sky Sanders
  • 12.1k
  • 3
  • 32
  • 60

###A: How do I get a question?

<!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>
    <script src="scripts/Soapi.Generated.js" type="text/javascript"></script>
    <script type="text/javascript">

        function run() {

            var apiKey = '';
            var factory = new Soapi.RouteFactory('api.stackapps.com', apiKey);

            var route = factory.QuestionsById(494);
            route.answers = true;
            route.body = true;




            var response = route.getResponse(
            function success(data) {

                alert(data.questions[0].title);
            },
            function error(err) {
                alert("Error:" + err.message);
            });


            // or
            factory.QuestionsById(494)
            .applyParameters(
            {
                answers: true,
                body: true
            })
            .getResponse(
            function success(data) {

                alert(data.questions[0].title);
            },
            function error(err) {
                alert("Error:" + err.message);
            });
        }
    </script>
</head>
<body onload="run()">
</body>
</html>