I am sending a request to Bing Maps REST service to get the location information such as coordinates etc, I entered this request (http://dev.virtualearth.net/REST/v1/Locations/query=rsa/gauteng/2001/johannesburg/melville?o=xml&key='mykey') in my web browser (as a test) and it returns the wrong location information. The returned xml suggests that I'm in the states somewhere in NY. Can anyone help me understand why this is?
I have read Microsoft's documentation on the web service and I'm following the proper structure to construct a request. I have Googled in a quest of getting a solution but no luck
Reverse Geocoding is the process of back (reverse) coding of a point location (latitude, longitude) to a readable address or place name. This permits the identification of nearby street addresses, places and/or real subdivisions such as neighbourhoods, county, state or country.
You're not issuing the request correctly. Bing provides two methods: structured query and non-structured. You're mixing both.
Structured ('REST' like):http://dev.virtualearth.net/REST/v1/Locations/CA/BC/V6G/Vancouver/Stanley%20Park%20Causeway?key=BingMapsKey
Non-structured (with query-string):http://dev.virtualearth.net/REST/v1/Locations?locality=London&postalCode=SW1A&key=BingMapsKey
As specified on the reference page (http://msdn.microsoft.com/en-us/library/ff701714.aspx) a request similar to yours would need to be done like this:
http://dev.virtualearth.net/REST/v1/Locations?countryRegion={country}&adminDistrict={district}&locality={locality}&key={key}
Also, you should use the 2-letter ISO code. Thus, South-Africa would be 'ZA'.
Your complete request will be:
It returns something like this:
Sencha/Extjs rest call with all parameters
json,rest,extjs,sencha-touch
You need to specify a writer config on your proxy with writeAllFields: true. By default it's false, and the default writer itself is just {type: 'json'}.
REST Jersey server JAX-RS 500 Internal Server Error
java,rest,jersey,jax-rs
IllegalAnnotationException: Class has two properties of the same name 'list' Look at your two model classes XmlMessageBean and ResponseList. Do you see any difference? The main difference (and the cause for the error), is the @XmlAccessorType(XmlAccessType.FIELD) annotation (or lack there of). JAXB by default will look for the public..
How to specify supported http operation for a resource in json-ld?
rest,http-method,json-ld
No, you can't specify it in the context. What you can do, however, is to bind an operation to a property in a Hydra ApiDocumentation (example 10 in the spec) and reference it via an HTTP Link header.
Spring service and Spring web app in one
spring,web-services,rest,spring-mvc,web
yes that is possible to combine with web-app for example your controller package into your restful controller also work that is possible to crud operation via restful web service..
No module named http_client error when trying to run django with django rest framework
python,django,rest
It looks like you are hitting issue 2969. It should work if you upgrade from Django 1.6 to 1.6.11. However, please note that 1.6 is now end of life and does not receive security fixes, so ideally you should upgrade to 1.7, or even better, the new 1.8 LTS.
Unable to select values from the select list
javascript,jquery,rest
Here is the working fiddle: https://jsfiddle.net/64djszjf/14/ If you take a look at the source js file: https://aui-cdn.atlassian.com/aui-adg/5.8.13/js/aui-experimental.js, there are few lines that sets unselectable class: populateResults: function(container, results, query) { var populate, id=this.opts.id; populate=function(results, container, depth) { var i, l, result, selectable, disabled, compound, node, label, innerContainer, formatted; results =..
Spring Data Rest executes query but returns 500 internal Server Error
java,spring,rest,spring-boot,spring-data-rest
Hum.. This is strange but I found this question and added a controller to call the method and it worked like a charm.. Obv this is not a fix, but it is a good workaround.. EDIT: The error happens because it is expecting an entity, so all I had to..
How to avoid abusive use of REST endpoint [closed]
java,javascript,rest
The answer is simple: Don't use the UI as the definitive state for your users. Stack Overflow is actually a great example of this. When I voted up your question, the UI only updated after the REST call to the backend completed successfully with no errors. So you should be..
How to expose existing REST API through Azure Service Bus (or through something else)
rest,azure,azureservicebus
If you want to access an On-Premise service from the Azure service/websites what you need is a Hybrid Connection. For that you will need a BizTalk service to redirect the trafic to your on-prem service. Here are the steps to how to setup a Hybrid connection: https://azure.microsoft.com/en-us/documentation/articles/web-sites-hybrid-connection-get-started/..
Link to another resource in a REST API: by its ID, or by its URL?
json,api,rest,api-design,hateoas
DO include absolute entity URIs in your responses (such as /customers/12 or even http://www.example.com/customers/12). DO NOT include just an entity's ID (such as 12) in a response, because that way you're forcing clients to put together resource URIs themselves. In order to do that, they would need to have prior..
Spring MVC - How to return simple String as JSON in Rest Controller
java,json,spring,rest,spring-mvc
A String as JSON? Proper JSON needs a key and a value { key: value } So either return text/plain (as in Return only string message from Spring MVC 3 Controller) OR wrap your String is some object public class StringResponse { private String response; public StringResponse(String s) { this.response..
Not able to hit 2nd services with generated Token
c#,web-services,rest,soap,drupal-services
Finally i figured out what was the issue i was creating new cookie container for both the request request.CookieContainer = new CookieContainer(); thus server was unable to authenticate Error was resolved by using this code CookieContainer cookieJar = new CookieContainer(); private void CreateObject() { try { string abc = ';..
REST API with token based authentication
angularjs,codeigniter,api,rest,token
You can use an API key, however - as you wrote - it's pure protection and easily accessible value - potential abuser just needs to view the source or investigate the queries. In general REST APIs are secured with tokens. At the beginning of the session (not in traditional meaning..
remote data fetching inside model object in objective c using AFNetworking
ios,objective-c,rest,model-view-controller,afnetworking-2
I dont have anything to say about your MVC(Model–view–controller) correct? I just want to add something that may be useful approach avoiding unwanted crashes. First is under [[MyAPI sharedInstance] POST:@'auth/' parameters:params success:^(NSURLSessionDataTask *task, id responseObject) { if([responseObject objectForKey:@'id']) { [[NSUserDefaults standardUserDefaults] setObject:(NSDictionary*) responseObject forKey:USER_KEY]; [[NSUserDefaults standardUserDefaults] synchronize]; result = [responseObject..
AngularJS $resource Custom Action for Requesting a Password Reset
angularjs,rest,ngresource,angularjs-1.3
yes, looks a little bit weird. Instead of GET I will use POST request to reset the password and pass the email param in request body
Can't save json data to variable (or cache) with angularjs $http.get
json,angularjs,web-services,rest
$http.get is asynchronous. When cache.get or return result are executed, HTTP request has not completed yet. How are you going to use that data? Display in UI? E.g. try the following: // Some View <div>{{myData}}</div> // Controller app.controller('MyController', function ($scope) { $http.get('yoururl').success(function (data) { $scope.myData = data; }); }); You..
@RestController throws HTTP Status 406
Modular v vst download. java,spring,rest,maven
The issue is with the dependencies that you have in pom.xml file. In Spring 4.1.* version the pom.xml dependency for Jackson libraries should include these: <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-core</artifactId> <version>2.4.1</version> </dependency> <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-databind</artifactId> <version>2.4.1.1</version> </dependency> You..
Consuming and exposing webservices in one project (.NET)
.net,web-services,rest,soap
If you are trying to enrich the data from one source and combine that with information from another source, I think this is a decent solution. I think it is better to have one single point to talk to (your REST service), than to have two in your application and..
.NET web service gets null object
c#,.net,ajax,web-services,rest
Possibly the mistake in this line var data = '{ 'c:':{'Id': '1', 'Name': 'myname'}'; should be var data = '{ 'c':{'Id': '1', 'Name': 'myname'}'; ..
In simple RESTful design, does PATCH imply mapping to CRUD's (ORM's) “update” and PUT to “destroy”+“create” (to replace a resource)?
database,rest,http,orm,crud
Well, Both the actions actually means update, where PUT is full update and PATCH is partial update. In case of PUT you already know the identifier of the resource and the resource already exists, so it is not a create and delete action per se. Infact, you can make do..
RESTful routing best practice when referencing current_user from route?
ruby-on-rails,rest
I would've added special routes for current user profile actions, in this case you don't have to check anything. Just load and display the data of current user. For example: /my-profile/edit /my-profile/newsfeed It's not that RESTful but you don't have to put extra checks keeping your code clean. If you..
(CORS) How does the browser know when to do a pre-flight request
javascript,rest,dom,xmlhttprequest,cors
The browser will send a preflight request if: You add custom headers to your request You use a method other than GET, HEAD or POST You use POST with an unusual Content-Type. More details here: HTTP access control (CORS), Preflighted requests..
Springboot REST application should accept and produce both XML and JSON
java,xml,rest,jackson,spring-boot
Try to add a @XmlRootElement(name='myRootTag') JAXB annotation with the tag you use as the root tag to the class MatchRequest. I have had similar issues when using both XML and JSON as transport format in a REST request, but using moxy instead of Jackson. In any case, proper JAXB annotations..
REST-API Different Content-Type on Error Response
java,json,api,rest,spring-mvc
User should always specify what content it's expecting with Accept header. It's you job to return the error that was thrown/caught on the server side in the format that was specified in Accept header. In spring as far as I know it could be achieved with a special mapper. Below..
Remove resource wrapper from CakePHP REST API JSON
rest,cakephp,cakephp-2.2
Use the Hash utility to rewrite the results returned before setting the data for the View:- class LeadPostsController extends AppController { public $components = array('RequestHandler'); public function index() { $records = $this->LeadPost->find('all', ['limit' => 20]); $this->set(array( 'leadposts' => Hash::extract($records, '{n}.LeadPost'), '_serialize' => 'leadposts' )); } } Here Hash::extract($records, '{n}.LeadPost') will..
Not able to create a WCF RestFul Service's client
asp.net,web-services,wcf,rest
I found the answer myself. In my service I had not declared an endpoint for met data exchange due to which when I was trying to add the reference of the service to the client the required app.config was not being generated. Adding the end point for metadata exchange solved..
Using .update with nested Serializer to post Image
django,rest,django-models,django-rest-framework,imagefield
As noted in the docs, .update() doesn't call the model .save() or fire the post_save/pre_save signals for each matched model. It almost directly translates into a SQL UPDATE statement. https://docs.djangoproject.com/en/1.8/ref/models/querysets/#update Finally, realize that update() does an update at the SQL level and, thus, does not call any save() methods on..
Ruby on Rails - Help Adding Badges to Application
ruby-on-rails,ruby,rest,activerecord,one-to-many
Take a look at merit gem. Even if you want to develop your own badge system from scratch this gem contains plenty of nice solutions you can use. https://github.com/merit-gem/merit
Retrofit updating class PUT error code 301
android,rest,retrofit,put
Finally I solved it. The problem was that we had two different Client objects and the one that you fetch is the one that you must change and use it to upload with PUT. I hope that this help somebody..
Mailchimp Ecommerce360 Javascript Implementation
javascript,rest,e-commerce,mailchimp
If you mean from client-side Javascript, this isn't possible because the MailChimp API doesn't support CORS and (in most cases) this is a huge security issue. You'll need to communicate with Javascript back to your own servers and have those machines make the requisite API calls.
Laravel: Retrieve polymorphic attributes efficiently
rest,laravel,polymorphism,eloquent 1134 serum download.
You might be almost there. Your getAvatarAttribute() is way too complicated, indeed. You could try to do something like: /** we hide the relation from the json */ protected $hidden = ['avatar']; /** we append the url of the avatar to the json */ protected $appends = ['avatar_url']; /** *..
How to manipulate local files with webdav
javascript,jquery,rest,file-upload,webdav
So I figured it out a while ago. I was thinking the wrong way. It is not the client that will do anything it will be the server. So the client can make a regular http call and just change the 'type' string from get or what ever to MKCOL..
How can I get json objects without the object number?
javascript,jquery,json,rest
Create an object. Precision auto tune up. Loop over the array Get the name of each member of the array Copy each member into the object using a property name that is the same as the name you just got Then just use the object instead of the array. You might want to..
How to send a JsonObject in JerseyClient POST call?
java,json,rest,jersey,jersey-client
You should add (de)serializators for JSONObject - jackson-datatype-json-org <dependency> <groupId>com.fasterxml.jackson.datatype</groupId> <artifactId>jackson-datatype-json-org</artifactId> <version>2.4.0</version> </dependency> And register module: ObjectMapper mapper = new ObjectMapper(); mapper.registerModule(new JsonOrgModule()); ..
How to respond in Middleware Slim PHP Framework
php,rest,authentication,middleware,slim
You cannot use halt in middleware: http://stackoverflow.com/a/10201595/2970321 Halt should only be invoked within the context of a route callback. Instead, you could manually generate a 400 response using PHP's header along with exit: header('HTTP/1.1 400 Access denied'); exit; Alternatively, you could define a new type of Exception: class AuthException extends..
Do we HAVE to generate and use client libraries to use Google App Engine's Endpoints?
ios,swift,rest,google-app-engine,google-cloud-endpoints
Yes, it's totally possible to access endpoints via HTTP requests. The client libraries just help you to generate those requests without having to know the exact URLs. The biggest part where the client libraries help you is for authentication, but if you authenticate with Google and get an access token..
Adding a pin annotation to a map view on a long press in swift
ios,swift,annotations,maps,mkmapview
1) Instantiate a UILongPressGestureRecognizer and add it to the MKMapView. 2) When the selector gets called after the user has a long press, call the addAnnotation method in MKMapView with the appropriate title and coordinate. 3) Then make sure you conform to the MKMapViewDelegate and implement viewForAnnotation: which will be..
Unable to upload file to Sharepoint @ Office 365 via REST
javascript,ajax,rest,sharepoint,office365
To me it just seems a bit light, visit this link https://msdn.microsoft.com/en-us/library/office/dn769086.aspx on technet, and compare your upload function to this: // Add the file to the file collection in the Shared Documents folder. function addFileToFolder(arrayBuffer) { // Get the file name from the file input control on the page..
Is JSON better than XML? Which one is more secured? [duplicate]
android,json,xml,web-services,rest
Dev.virtualearth.net Rest Json File
In compare to JSON and XML , there is no difference in security but JSON is much faster than XML thats why we prefer JSOn over XMl..But if you see from security point of view than you can go for SOAP
C Dev.virtualearth.net Rest Json FileSpring Boot REST display id of parent only in a JSON response
json,spring,rest,spring-boot
Basically returning entities directly from endpoints isn't a good idea. You make very tight coupling between DB model and responses. Instead, implement a POJO class that will be equivalent of the HTTP response you sent. This POJO will have all ChildEntity fields and parentId only and will be constructed in..
Create a unique URL for linking to data pulled from a database [closed]
javascript,html,sql,google-maps,maps
C Dev.virtualearth.net Rest Json Files
If you don't want to do anything on the server to provide a unique url, you can use a client side hash with urls in the form /mymap#uniqueId. The hashed part of the url is accessible in javascript like so: window.location.hash You can even set that property on the location..
REST api : correctly ask for an action
api,rest,endpoint
Try to separate API from your application logic. From API you GET the quote and API from now on shouldn't care what you do with that data. The same with marking quotes as favorites. It's your application's and user db's problem how to mark something. Again, API should care only..
Jersey JUnit Test: @WebListener ServletContextListener not invoked
java,rest,junit,jersey,jax-rs
The JerseyTest needs to be set up to run in a Servlet environment, as mentioned here. Here are the good parts: @Override protected TestContainerFactory getTestContainerFactory() { return new GrizzlyWebTestContainerFactory(); } @Override protected DeploymentContext configureDeployment() { ResourceConfig config = new ResourceConfig(SessionResource.class); return ServletDeploymentContext.forServlet(new ServletContainer(config)) .addListener(AppContextListener.class) .build(); } See the APIs for..
Default/Constant values for POST/PUT arguments with Retrofit
java,rest,retrofit
Maybe one option would be to send an object, which encapsulates all your values, instead of all string values separately? The object would implement your default values. For example, you could create a class: public class CreateObject { private String type = 'constant'; private String value; private String otherValue; public..
Intercepting login calls with Spring-Security-Rest plugin in Grails
rest,grails,spring-security
Yes, you can provide a custom bean that implements the RestAuthenticationSuccessHandler. Take a look at the API documentation for the class to see what you need to implement. Then it's as simple as overriding the bean in your application context: // Resources.groovy restAuthenticationSuccessHandler(MyCustomRestAuthenticationSuccessHandler) { renderer = ref('accessTokenJsonRenderer') } It might..
Adding authorization to routes
ruby-on-rails,rest,routes,authorization
Do you know the gems rolify and CanCanCan? I think they can help you manage authorizations on resources in a single place instead of having to do it in every controller..
What's the best way to map objects into ember model from REST Web API?
json,rest,ember.js,asp.net-web-api,ember-data
I think this should fix your problem: export default DS.RESTSerializer.extend({ primaryKey: 'inventory_id' }); With this parameter Ember Data will map inventory_id to it's id parameter..
![]() Stuck with nested serializer using Django Rest Framework and default user
django,api,rest,django-rest-framework,serializer
By default DRF will look at an attribute on the User model named after the serializer's field (member here). However the related name is profile. This can be worked around by passing the source='profile' to your MemberProfileSerializer..
Trying to write a unit test for file upload to a django Restless APIDev.virtualearth.net Rest Json Editor
python,django,rest,file-upload,request
I tried to fix this but in the end it was quicker and easier to switch to the Django-REST framework. The docs are so much better for Djano-REST that it was trivial to set it up and build tests. There seem to be no time savings to be had with..
JsonHow to make Jersey Unit test for Post method
java,rest,junit,jersey,jax-rs
C Dev.virtualearth.net Rest Json Converter
@Path('hello') public static class HelloResource { @POST @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) public String doPost(Map<String, String> data) { return 'Hello ' + data.get('name') + '!'; } } @Override protected Application configure() { return new ResourceConfig(HelloResource.class); } @Test public void testPost() { Map<String, String> data = new HashMap<String, String>(); data.put('name', 'popovitsj'); final String hello..
Comments are closed.
|
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |