Search Results

Search found 31918 results on 1277 pages for 'google maps api 3'.

Page 41/1277 | < Previous Page | 37 38 39 40 41 42 43 44 45 46 47 48  | Next Page >

  • Pure Front end JavaScript with Web API versus MVC views with ajax

    - by eyeballpaul
    This was more a discussion for what peoples thoughts are these days on how to split a web application. I am used to creating an MVC application with all its views and controllers. I would normally create a full view and pass this back to the browser on a full page request, unless there were specific areas that I did not want to populate straight away and would then use DOM page load events to call the server to load other areas using AJAX. Also, when it came to partial page refreshing, I would call an MVC action method which would return the HTML fragment which I could then use to populate parts of the page. This would be for areas that I did not want to slow down initial page load, or areas that fitted better with AJAX calls. One example would be for table paging. If you want to move on to the next page, I would prefer it if an AJAX call got that info rather than using a full page refresh. But the AJAX call would still return an HTML fragment. My question is. Are my thoughts on this archaic because I come from a .net background rather than a pure front end background? An intelligent front end developer that I work with, prefers to do more or less nothing in the MVC views, and would rather do everything on the front end. Right down to web API calls populating the page. So that rather than calling an MVC action method, which returns HTML, he would prefer to return a standard object and use javascript to create all the elements of the page. The front end developer way means that any benefits that I normally get with MVC model validation, including client side validation, would be gone. It also means that any benefits that I get with creating the views, with strongly typed html templates etc would be gone. I believe this would mean I would need to write the same validation for front end and back end validation. The javascript would also need to have lots of methods for creating all the different parts of the DOM. For example, when adding a new row to a table, I would normally use the MVC partial view for creating the row, and then return this as part of the AJAX call, which then gets injected into the table. By using a pure front end way, the javascript would would take in an object (for, say, a product) for the row from the api call, and then create a row from that object. Creating each individual part of the table row. The website in question will have lots of different areas, from administration, forms, product searching etc. A website that I don't think requires to be architected in a single page application way. What are everyone's thoughts on this? I am interested to hear from front end devs and back end devs.

    Read the article

  • Subscribe to RSS Feeds in Chrome with a Single Click

    - by Asian Angel
    Do you have a Google Reader account and need a quick simple way to subscribe to new RSS feeds while you browse? Then you will definitely want to have a look at the Chrome Reader extension for Chrome. Before If you want to add a new feed to your Google Reader account in Chrome then you have to do it manually. A single feed now and then is not a problem but if you are wanting to build a serious set of RSS feeds quickly then not so good. Chrome Reader in Action Once the extension is installed you are ready to go. Any time that you visit a webpage with an RSS feed available you will see the familiar orange feed icon appear in your “Address Bar”. To add the feed to your Google Reader account just click on the orange feed icon. Note: You will need to be logged into your Google Reader account in your browser. When you click on the orange feed icon a small drop-down window will appear where you can modify the feed name and/or add it to a “custom folder” if desired. Notice that the orange feed icon has changed to the familiar Google Reader icon indicating that the feed has been added to the account. Now you are ready to continue browsing…no other actions are required. And now to subscribe to the Microsoft feed at Ars Technica. Once again a single click and all done. Refreshing our Google Reader page shows both of our new RSS feeds ready to enjoy. Conclusion The Chrome Reader extension makes it as simple as can be to add new RSS feeds to your Google Reader account while browsing with Chrome. Links Download the Chrome Reader extension (Google Chrome Extensions) Similar Articles Productive Geek Tips Access Your favorite RSS Feeds in Windows Media CenterChange Default Feed Reader in FirefoxUse Outlook 2007 as an RSS ReaderInstall Extensions in Google ChromeMake Outlook Stop Using Internet Explorer’s RSS Feeds TouchFreeze Alternative in AutoHotkey The Icy Undertow Desktop Windows Home Server – Backup to LAN The Clear & Clean Desktop Use This Bookmarklet to Easily Get Albums Use AutoHotkey to Assign a Hotkey to a Specific Window Latest Software Reviews Tinyhacker Random Tips DVDFab 6 Revo Uninstaller Pro Registry Mechanic 9 for Windows PC Tools Internet Security Suite 2010 Out of band Security Update for Internet Explorer 7 Cool Looking Screensavers for Windows SyncToy syncs Files and Folders across Computers on a Network (or partitions on the same drive) If it were only this easy Classic Cinema Online offers 100’s of OnDemand Movies OutSync will Sync Photos of your Friends on Facebook and Outlook

    Read the article

  • How to create Ror style Restful routing in Asp.net MVC Web Api

    - by Jas
    How to configure routing in asp.net web api, to that I can code for the following actions in my ApiController inherited class? |======================================================================================| |Http Verb| Path | Action | Used for | |======================================================================================| | GET | /photos | index | display a list of all photos | | GET | /photos/new | new | return an HTML form for creating a new photo | | POST | /photos/ | create | create a new photo | | GET | /photos/:id | show | display a specific photo | | GET | /photos/:id/edit | edit | return an HTML form for editing a photo | | PUT | /photos/:id | update | update a specific photo | | DELETE | /photos/:id | destroy | delete a specific photo |

    Read the article

  • FaceBook Graph API

    - by LingAi
    Hi All, When I use FaceBook API for retrieving posts information, I found that the returned information are changing all the time. for e.g., when I retrieved information 2 times with 1mins interval, one record appears in the 1st time, and disapeared in the 2nd time. https://graph.facebook.com/search?q=baby&type=post&limit=100&since=2010-05-19&until=2010-05-21 Does anyone know what happen? Cheers, LingChen

    Read the article

  • API's

    - by raghu.yadav
    lets dump API's here .... // if you want to put/get something in/from the pageFlowScope, use thisMap pfsMap = AdfFacesContext.getCurrentInstance().getPageFlowScope(); pfsMap.put(key, value); // pfsMap.put("#{pageFlowScope.param}, "sample"); pfsMap.get(key); // pfsMap.get("#{pageFlowScope.param} // if you want to set bean's property value, use this MyBackingBean bean = (MyBackingBean)pfsMap.get("my_backing_bean_name"); // the name under which the bean is registered in the task flow bean.setMyParam(newValue);

    Read the article

  • youtube python api gdata.service. requesterror

    - by nashr rafeeg
    i have the following code which is trying to add a set of videos into a youtube play list import urllib,re import gdata.youtube import gdata.youtube.service class reddit(): def __init__(self, rssurl ='http://www.reddit.com/r/chillmusic.rss' ): self.URL = rssurl self._downloadrss() def _downloadrss(self): if self.URL.endswith('.rss'): # Downloadd the RSS feed of the subreddit - save as "feed.rss" try: print "Downloading rss from reddit..." urllib.urlretrieve (URL, "feed.rss") except Exception as e: print e def clean(self): playList = open("feed.rss").read() links = re.findall(r'(http?://www.youtube.com\S+)', playList) for link in links: firstPass = link.replace('&quot;&gt;[link]&lt;/a&gt;', '') secondPass = firstPass.replace('&amp;amp;fmt=18', '') thirdpass = secondPass.replace('&amp;amp;feature=related', '') finalPass = thirdpass.replace('http://www.youtube.com/watch?v=', '') print thirdpass, "\t Extracted: ", finalPass return finalPass class google(): def __init__(self, username, password): self.Username = username self.password = password #do not change any of the following self.key = 'AI39si5DDjGYhG_1W-8n_amjgEjbOU27sa0aw2RQI5gOaoK5KqCD2Fzffbkh8oqGu7CqFQLLQ7N7wK0gz7lrTQbd70srC72Niw' self.appname = 'Reddit playlist maker' self.service = gdata.youtube.service.YouTubeService() def authenticate(self): self.service.email = self.Username self.service.password = self.password self.service.developer_key = self.key self.service.client_id = self.appname self.service.source = self.appname self.service.ssl = False self.service.ProgrammaticLogin() def get_playlists(self): y_playlist = self.service.GetYouTubePlaylistFeed(username='default') l = [] k = [] for p in y_playlist.entry: k=[] k=[p.link[1].href, p.title.text] l.append(k) return l def get_playlist_id_from_url(self, href): #quick and dirty method to get the playList id's return href.replace('http://www.youtube.com/view_play_list?p=','') def creat_playlist(self, name="Reddit list", disc ="videos from reddit"): playlistentry = self.service.AddPlaylist(name, disc) if isinstance(playlistentry, gdata.youtube.YouTubePlaylistEntry): print 'New playlist added' return playlistentry.link[1].href def add_video_to_playlist(self,playlist_uri,video): video_entry = self.service.AddPlaylistVideoEntryToPlaylist( playlist_uri, video) if isinstance(video_entry, gdata.youtube.YouTubePlaylistVideoEntry): print 'Video added' URL = "http://www.reddit.com/r/chillmusic.rss" r = reddit(URL) g = google('[email protected]', 'xxxx') g.authenticate() def search_playlist(playlist="Reddit list3"): pl_id = None for pl in g.get_playlists(): if pl[1] == playlist: pl_id = pl[0] print pl_id break if pl_id == None: pl_id = g.creat_playlist(name=playlist) return pl_id pls = search_playlist() for video_id in r.clean(): g.add_video_to_playlist(pls, video_id) when i run the code i am geting the following error message gdata.service.RequestError: {'status': 303, 'body': '', 'reason': 'See Other'} any one have any idea why i am getting this error cheers Nash

    Read the article

  • How can i use Google-o-Meter or Google Vizualisation API with Jenkins

    - by kamal
    Here is a sample that displays a static chart: google.load("visualization", "1.0", {packages:["imagechart"]}); google.setOnLoadCallback(drawChart); function drawChart() { var dataTable = new google.visualization.DataTable(); dataTable.addColumn('string'); dataTable.addColumn('number'); dataTable.addColumn('string'); // Row data is [chl, data point, point label] dataTable.addRows([ ['January',40,undefined], ['February',60,'Initial recall'], ['March',60,'Product withdrawn'], ['April',45,undefined], ['May',47,'Relaunch'], ['June',75,undefined], ['July',70,undefined], ['August',72,undefined] ]); var options = {cht: 'lc', chds:'0,160', annotationColumns:[{column:2, size:12, type:'flag', priority:'high'},]}; var chart = new google.visualization.ImageChart(document.getElementById('line_div')); chart.draw(dataTable, options); } How can i replace the static values and variables in dataTable.addRows([ with real live data ? In case the compete code is not visible, refer to : http://code.google.com/apis/visualization/documentation/gallery/genericimagechart.html When this Javascript is copied to the "Description" it renders a chart, what i want to know is how to replace the name/value in dataTable.addRows, to the name/values coming from Jenkins

    Read the article

  • Google I/O 2010 - Porting v2 JavaScript Maps API apps to v3

    Google I/O 2010 - Porting v2 JavaScript Maps API apps to v3 Google I/O 2010 - Stepping up: Porting v2 JavaScript Maps API applications to v3 Geo 201 Daniels Lee The JavaScript Maps API v3 is the future of the Google Maps API. To take advantage of the many great features coming to the API you will need to migrate existing v2 applications to v3. This session will guide you through the process, illustrating how easy it is to start reaping the benefits in features and performance. For all I/O 2010 sessions, please go to code.google.com From: GoogleDevelopers Views: 10 0 ratings Time: 01:04:07 More in Science & Technology

    Read the article

  • Ruby library for Flickr API?

    - by rubayeet
    Is there a solid, production ready library in Ruby that interacts with the Flickr API? I found a few by googing, but their states don't impress me much. I'm looking for something along the lines of flickrapi for Python, with nice documentation.

    Read the article

  • Authentication for users on a Single Page App?

    - by John H
    I have developed a single page app prototype that is using Backbone on the front end and going to consume from a thin RESTful API on the server for it's data. Coming from heavy server side application development (php and python), I have really enjoyed the new different design approach with a thick client side MVC but am confused on how best to restrict the app to authenticated users who log in. I prefer to have the app itself behind a login and would also like to implement other types of logins eventually (openid, fb connect, etc) in addition to the site's native login. I am unclear how this is done and have been searching - but unsuccessful in finding information that made it clear to me. In the big picture, what is the current best practice for registering users and requiring them to login to use your single page app? Once a user is logged in, how are the api requests authenticated? Can I store a session but how do I detect for this session in the API calls? Any answers to this would be much appreciated!

    Read the article

  • Google Maps API v3... non-mobile?

    - by andrhamm
    I'm trying to make a Google Maps widget for my website but all of the examples are for full-screen mobile devices. The tutorials work when I copy paste them exactly as shown but they don't seem to work when I want them to only occupy a portion of the page. From what I've read, the v3 is the best API yet (for what I need) because of its speed and compatibility with mobile devices. I plan to make a widget very similar to the MarkerClusterer example from the demo gallery but I can't get it working. Is this a common issue? I know I'm being vague but I would appreciate some help. Thanks

    Read the article

  • Google Maps API Round-up

    Google Maps API Round-up This week, Mano Marks and Paul Saxman go over recent launches and things you might have missed with the Google Maps APIs, including the new Google Time Zone API, traffic estimates with the Directions API (for enterprise customers), and the Places Autocomplete API query results and data service enhancements. From: GoogleDevelopers Views: 0 0 ratings Time: 00:00 More in Education

    Read the article

  • GDD-BR 2010 [0B] Maps API V3: New Features and How to Use them

    GDD-BR 2010 [0B] Maps API V3: New Features and How to Use them Speaker: Ossama Alami Track: Google APIs Time slot: B [11:15 - 12:00] Room: 0 Level: 201 The Javascript Maps API v3 is the future of the Google Maps API. Come learn why we built it, how to use it and about some exciting new features not available in V2. From: GoogleDevelopers Views: 2 0 ratings Time: 43:37 More in Science & Technology

    Read the article

  • Google Maps API Office Hours

    Google Maps API Office Hours Interested in knowing more about the Google Maps API announcements that were made at I/O? During this week's Google Maps API Office Hours, +Josh Livni and +Paul Saxman will give an overview of the Google Maps API features that were announced at I/O, and will talk about the I/O session content that is now available online. The next Office Hours will be this Tuesday at 11am, Pacific Time. Bring your questions, and join us there! From: GoogleDevelopers Views: 167 9 ratings Time: 21:25 More in Science & Technology

    Read the article

  • How can I create numbered map markers in Google Maps V3?

    - by kaneuniversal
    I'm working on a map that has multiple markers on it. These markers use a custom icon, but I'd also like to add numbers on top. I've seen how this has been accomplished using older versions of the API. How can I do this in V3? *Note -- the "title" attribute creates a tooltip when you mouseover the marker, but I want something that will be layered on top of the custom image even when you're not hovering on top of it. Here's the documentation for the marker class, and none of these attributes seem to help: http://code.google.com/apis/maps/documentation/v3/reference.html#MarkerOptions Thank you . . . . Michael

    Read the article

  • Visualizing Data with the Google Maps API: A Journey of 245k Points

    Visualizing Data with the Google Maps API: A Journey of 245k Points What can you do with some awesome geospatial data, the Google Maps API, and a couple of days of hacking and analysis? Brendan and Paul walk through how they used the Maps API to visualize the CLIWOC database, and pass on tips and trick for doing the same with other geospatial datasets. CLIWOC (Climatological Database for the World's Oceans, 1750-1850): www.ucm.es From: GoogleDevelopers Views: 0 0 ratings Time: 00:00 More in Education

    Read the article

  • Google Bar Chart Time Label Interval

    - by Alex Angelini
    Hi I am using Google Bar Chart through the visualization API on my site: http://code.google.com/apis/visualization/documentation/gallery/imagebarchart.html And my x-axis is time, and every time interval is a time of day in the format (HH:MM) Here is my code for the graph: <script type="text/javascript" src="https://www.google.com/jsapi"></script> <script type="text/javascript"> %s google.load("visualization", "1", {packages:["imagebarchart"]}); google.setOnLoadCallback(drawChart); function drawChart() { var data = new google.visualization.DataTable(); data.addColumn('string', 'Date'); data.addColumn('number', 'Amount'); data.addRows({{Rows}}); %s var chart = new google.visualization.ImageBarChart(document.getElementById('chart_div')); chart.draw(data, {width: 900, height: 340, min: 0, isVertical:true, legend:'none'}); } </script> The rows of data are added later using a templating engine, but that is the jist of my chart. Because I have added my time variable as 'string' I cannot use the valueLabelsInterval option to only show every 4 labels. Because I can't do that the labels overlap and look ugly. Is there any other way to only show every other time label or every 4th one, I read through the docs but could not see how to do it. Any help would be greatly appreciated thanks

    Read the article

  • Why am I unable to send an attachment with Outlook via SMTP that I am able to send via Gmail / Google Apps?

    - by cwd
    I have Google Apps installed and I have tried to set up Outlook 2007 to send messages via SMTP. I followed the guide, selecting what I believe are all the correct settings. Yes, I am using POP for incoming, that is intentional but I don't believe it should affect outgoing messages. When I log into gmail (google apps) for my company, I can send a message that has an 8MB attachment (pdf file, not zipped or anything) and it sends fine. However, when I send the same message in Outlook with that same 8mb attachment it fails. Why am I unable to send an attachment with Outlook via SMTP that I am able to send via Gmail / Google Apps? The message headers are (some info omitted for privacy): Technical details of permanent failure: Google tried to deliver your message, but it was rejected by the recipient domain. We recommend contacting the other email provider for further information about the cause of this error. The error that the other server returned was: 552 552 #5.3.4 message size exceeds limit (state 17). ----- Original message ----- DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=company.com; s=google; h=from:to:cc:references:in-reply-to:subject:date:message-id :mime-version:content-type:x-mailer:thread-index:content-language; bh=7d4i/Cbt0v0sY3zt5lN6y5CdvxjbRmTBG4AuBuMxtF4=; b=IJwwxuIEdg1E4zXuGjeDod+1w3RYBBCNzSsqpuX77ih36HSiq++s3ZCQXPeU9CIZVg K8JPJQu9xjivYYjrRaYwyeowLIu0GIdR2h4kKEkFM/GNC2RFF3VwVgj+gvi5eqVZIuWn osT5/VEm10IED6B54NPOtGMgFTci6a57zzVKE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:references:in-reply-to:subject:date:message-id :mime-version:content-type:x-mailer:thread-index:content-language :x-gm-message-state; bh=7d4i/Cbt0v0sY3zt5lN6y5CdvxjbRmTBG4AuBuMxtF4=; b=LjTecjok5K71Bymp6tZqAL2XCz03hWROV1mTK8Vf2AeEJwtel9ACu9kE5jW5iJqckb upYKPzoqYLBwAPOzMb9asWoTAZPzC7LMG65eDUc2/ZEvGqXrZs3ziUxwhF4t169yRVuy /6nm/aAt5uPMLPdobxGTJ8ahOIku1Z3gW+OcvZ6ERk1Av/bvuln09vcnyJIrHGh7eK8n cbGVxmK0aecgSPgIj2NALbHkyuxwj+LEBRV6uiz3THDjxAiNfsO5UFjV59sD+lVSBT3z ThOGE8WEXRnKHuP3FuKXyeUxKBZ2CxpWJpvDuS9EsFkln7zkISYEsRA0nUA6GSGi2Z/n 8YUg== Received: by 10.60.169.197 with SMTP id ag5mr12254920oec.137.1351036287413; Tue, 23 Oct 2012 16:51:27 -0700 (PDT) References: Date: Tue, 23 Oct 2012 19:51:16 -0400 Message-ID: <003a01cdb179$4bb2ca60$e3185f20$@com> MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_NextPart_000_003B_01CDB157.C4A12A60" X-Mailer: Microsoft Office Outlook 12.0 Thread-Index: Ac2xVCHGxoC7DDOkQBK3JSXowHb0EQAEB7agAAA/YKAAAIGcQAAAngfQAABAAPAAAFe7gAAAadvw AALgvLA= Content-Language: en-us X-Gm-Message-State: ALoCoQniMq7Fnh+NlfoWjTJPvKWbkhEaftSaFo9ZVvtRpWufTmhlRDx1a9Jf+wmYcbRh896gygNr The company I am sending email to is a company that uses Google Apps for Teams. This is their apps admin login. Should I be worried about that message? My Settings On the Google apps side I have set my SPF record and set / verified my DKIM key. Here are my outlook settings: Why am I unable to send an attachment with Outlook via SMTP that I am able to send via Gmail / Google Apps?

    Read the article

  • Google Chrome is in Danish

    - by Mad Cow
    I'm not sure what i have done, but by default, Chrome comes up in Danish. I can ignore this most of the time but its v annoying and i cant seem to change it. For example google directions come up in Danish too and have to be translated back to English! I have tried the spanner icon, and i've confirmed the only two languages specified are En and US English. Does anyone have any ideas how i can default it back to English all the time. In-lined the original screenshot from www.cow-shed.co.uk Thanks

    Read the article

  • Keyboard Shortcuts for Google.com

    - by Dean
    I can ALT+TAB to Chrome, then CTRL+T to a new tab, then type my request and hit ENTER, but then when I want to look into the first search result I need to take my hand off the keyboard to click it?? Surely someone can recommend a plugin which enables me to just press 1 to go to the first search result, 2 for the second, etc. Or something like that? EDIT: This Greasemonkey script offers precisely what I want, and appears to install perfectly well on Chrome - but doesn't work at all :( Also, I'm using Google Chrome 4.0.249.43 on 64 bit Ubuntu 9.10.

    Read the article

  • Analyse frequencies of date ranges in Google Spreadsheet

    - by wnstnsmth
    I have a Google Spreadsheet where I would like to compute occurrences of date ranges. As you can see in my sheet, there is a column date_utc+1 which contains almost random date data. What I would like to do is put the date values into bins of 6 hours each, i.e., 12/5/2012 23:57:04 until 12/6/2012 0:03:17 would be in the first bin, 12/6/2012 11:20:53 until 12/6/2012 17:17:07 in the second bin, and so forth. Then, I would like to count the occurrence of those bins, such as bin_from bin_to freq ----------------------------------------------- 12/5/2012 23:57:04 12/6/2012 0:03:17 2 12/6/2012 11:20:53 12/6/2012 17:17:07 19 ... ... ... Hope it is clear what I mean. Partial hints are very welcome as well since I am pretty new to spreadsheeting.

    Read the article

  • Shockwave not responding in Google Chrome

    - by Nithish Inpursuit Ofhappiness
    When browsing in Google chrome, I get an error message The exception unknown software exception (0x40000015) occurred in the application at location 0x0025bf18. I get a pop-up message later saying that the shockwave plugin is not responding. I've tried uninstalling and re-installing Chrome (even by clearing my browsing data while uninstalling) and still the error persists. There are 2 instances of shockwave that I could see in my chrome by typing chrome://plugins. I've tried disabling either of those alternatively too. This prevents me from browsing a lot of sites including FB and Stackoverflow through my favorite browser. I dont have any problem when I work from Internet Explorer. Please help!

    Read the article

  • ASP.NET Web API - Screencast series with downloadable sample code - Part 1

    - by Jon Galloway
    There's a lot of great ASP.NET Web API content on the ASP.NET website at http://asp.net/web-api. I mentioned my screencast series in original announcement post, but we've since added the sample code so I thought it was worth pointing the series out specifically. This is an introductory screencast series that walks through from File / New Project to some more advanced scenarios like Custom Validation and Authorization. The screencast videos are all short (3-5 minutes) and the sample code for the series is both available for download and browsable online. I did the screencasts, but the samples were written by the ASP.NET Web API team. So - let's watch them together! Grab some popcorn and pay attention, because these are short. After each video, I'll talk about what I thought was important. I'm embedding the videos using HTML5 (MP4) with Silverlight fallback, but if something goes wrong or your browser / device / whatever doesn't support them, I'll include the link to where the videos are more professionally hosted on the ASP.NET site. Note also if you're following along with the samples that, since Part 1 just looks at the File / New Project step, the screencast part numbers are one ahead of the sample part numbers - so screencast 4 matches with sample code demo 3. Note: I started this as one long post for all 6 parts, but as it grew over 2000 words I figured it'd be better to break it up. Part 1: Your First Web API [Video and code on the ASP.NET site] This screencast starts with an overview of why you'd want to use ASP.NET Web API: Reach more clients (thinking beyond the browser to mobile clients, other applications, etc.) Scale (who doesn't love the cloud?!) Embrace HTTP (a focus on HTTP both on client and server really simplifies and focuses service interactions) Next, I start a new ASP.NET Web API application and show some of the basics of the ApiController. We don't write any new code in this first step, just look at the example controller that's created by File / New Project. using System; using System.Collections.Generic; using System.Linq; using System.Net.Http; using System.Web.Http; namespace NewProject_Mvc4BetaWebApi.Controllers { public class ValuesController : ApiController { // GET /api/values public IEnumerable<string> Get() { return new string[] { "value1", "value2" }; } // GET /api/values/5 public string Get(int id) { return "value"; } // POST /api/values public void Post(string value) { } // PUT /api/values/5 public void Put(int id, string value) { } // DELETE /api/values/5 public void Delete(int id) { } } } Finally, we walk through testing the output of this API controller using browser tools. There are several ways you can test API output, including Fiddler (as described by Scott Hanselman in this post) and built-in developer tools available in all modern browsers. For simplicity I used Internet Explorer 9 F12 developer tools, but you're of course welcome to use whatever you'd like. A few important things to note: This class derives from an ApiController base class, not the standard ASP.NET MVC Controller base class. They're similar in places where API's and HTML returning controller uses are similar, and different where API and HTML use differ. A good example of where those things are different is in the routing conventions. In an HTTP controller, there's no need for an "action" to be specified, since the HTTP verbs are the actions. We don't need to do anything to map verbs to actions; when a request comes in to /api/values/5 with the DELETE HTTP verb, it'll automatically be handled by the Delete method in an ApiController. The comments above the API methods show sample URL's and HTTP verbs, so we can test out the first two GET methods by browsing to the site in IE9, hitting F12 to bring up the tools, and entering /api/values in the URL: That sample action returns a list of values. To get just one value back, we'd browse to /values/5: That's it for Part 1. In Part 2 we'll look at getting data (beyond hardcoded strings) and start building out a sample application.

    Read the article

< Previous Page | 37 38 39 40 41 42 43 44 45 46 47 48  | Next Page >