Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Web Service Calls to Get a Header retrieval

Posted on 2014-04-03
4
Medium Priority
?
183 Views
Last Modified: 2014-04-10
Hello, I am looking for a way to get a header section retrieved by posting a url.  How do I do this?  The url would be done by a REST API.  Does anybody know how the REST api works?  Thanks!
0
Comment
Question by:VBBRett
  • 2
4 Comments
 
LVL 54

Accepted Solution

by:
Scott Fell,  EE MVE earned 2000 total points
ID: 39977758
You can use jquery  http://api.jquery.com/jquery.getjson/ and below is sample to use a flicker api
<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>jQuery.getJSON demo</title>
  <style>
  img {
    height: 100px;
    float: left;
  }
  </style>
  <script src="//code.jquery.com/jquery-1.10.2.js"></script>
</head>
<body>
 
<div id="images"></div>
 
<script>
(function() {
  var flickerAPI = "http://api.flickr.com/services/feeds/photos_public.gne?jsoncallback=?";
  $.getJSON( flickerAPI, {
    tags: "mount rainier",
    tagmode: "any",
    format: "json"
  })
    .done(function( data ) {
      $.each( data.items, function( i, item ) {
        $( "<img>" ).attr( "src", item.media.m ).appendTo( "#images" );
        if ( i === 3 ) {
          return false;
        }
      });
    });
})();
</script>
 
</body>
</html>

Open in new window


MS  has a video on consuming a WCF http://msdn.microsoft.com/en-us/data/gg617675

If you use jquery ajax https://api.jquery.com/jQuery.ajax/ you can use the head method
$.ajax({
  type: "HEAD",
  url: "/Folder/URL/",
  data: { name: "John", location: "Boston" }
})
  .done(function( msg ) {
    alert( "Data Saved: " + msg );
  });

Open in new window

0
 
LVL 25

Expert Comment

by:apeter
ID: 39978525
You want to read the header in "asp.net web api" controller ?
0
 

Author Comment

by:VBBRett
ID: 39978632
Here is what I am attempting to do:

I know how to work with web services to a degree like MVC, WCF, etc, but I am looking to work with a REST API from Oracle's Taleo.  So, here is the process that I am trying to do:

1. Use a POST url which contains a user id and password and be able to retrieve a response which contains a record called authToken.  So the response should be something like the following when running it through FireFox RESTClient:

"response" : {"authoToken: "webapi123456789101112131415"}, "status" :{"detail" :{}, "success":true}}

2. Attach the "webapixxx" string as a header authToken and send a GET with  URL to get records back.  Not sure exactly how this is done.  If you guys could guide me, I'd appreciate that.  Thanks!  And one more thing, can this be done with a console application?
0
 
LVL 54

Assisted Solution

by:Scott Fell, EE MVE
Scott Fell,  EE MVE earned 2000 total points
ID: 39978661
In the console you can always run the code on the page and view the response back.  In chrome console, click on the Network tab, then find the page you are posting to.  Make your call and you will see the page added.  Now click on that and you can see the headers, preview and response on the right.  All the browser consoles will work about like that.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
CSS is a visual language used to classify objects and define rules about how they should be displayed. CSS skills aren’t restricted to developers anymore, there is a big benefit to having a basic understanding of the language, regardless of your occ…
In this tutorial viewers will learn how to style different bullet points for unordered lists in CSS. Begin with a normal unordered list; the default bullet point is a solid circle: In the CSS, create a defined class of unordered list by typing "ul.S…
In this tutorial viewers will learn how to embed custom externally-hosted Google Fonts using the Google Font API in CSS Go to the Google Fonts website at google.com/fonts: Browse or search based on font properties or name to find a suitable font for…
Suggested Courses

824 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question