Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Web Service Calls to Get a Header retrieval

Posted on 2014-04-03
4
Medium Priority
?
181 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 53

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 53

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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Unordered lists (HTML ul tags) are very handy to create menus of all types, shapes and sizes.  All it takes is a little knowledge of CSS and the possibilities are endless. First off, you should know the general format for menus created using the …
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…
Suggested Courses

705 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