Solved

Web Service Calls to Get a Header retrieval

Posted on 2014-04-03
4
170 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 52

Accepted Solution

by:
Scott Fell,  EE MVE earned 500 total points
Comment Utility
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
Comment Utility
You want to read the header in "asp.net web api" controller ?
0
 

Author Comment

by:VBBRett
Comment Utility
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 52

Assisted Solution

by:Scott Fell, EE MVE
Scott Fell,  EE MVE earned 500 total points
Comment Utility
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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

As a result of several questions about how to use Bootstrap I thought it would be a good idea to write down the development aspect of creating a Bootstrapped website in as little time as possible. Part 1 of this article will only concentrate on g…
Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
In this Micro Tutorial viewers will learn how to create navigation buttons that change on rollover, using CSS (Continuation of the CSS Image Sprite tutorial) Create a parent ID for all the list items       - Specify position: absolute and display: block…
In this tutorial viewers will learn how to customize the background color and font color of highlighted text using the ::selection element in CSS Begin by defining the selected text as an element in CSS by typing "::selection": Style the ::selection…

762 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now