I have integrated yahoo into iphone app but i am getting error:400 bad request - iphone

I have to access social information for the logged-in user.i have used following link. http://developer.yahoo.com/social/sdk/objectivec
i have used send request method to get user information.
but i am getting following error message
<
?xml version='1.0' encoding='utf-8'?>
<error xmlns='http://yahooapis.com/v1/base.rng'
xml:lang='en'>
<description>400 Bad Request</description>
<detail>400 Error : syntax error, unexpected &apos;(&apos; at "*(*null)"
can any one help me?
thank you in advance.

The Yahoo Web server (running the Web site) thinks that the data stream sent by the client (e.g. your Web browser or our CheckUpDown robot) was 'malformed' i.e. did not respect the HTTP protocol completely. So the Web server was unable to understand the request and process it. so make sure you are sending the well structured request.
Based on your commented:
http://nullinfo.wordpress.com/oauth-yahoo/
http://developer.yahoo.com/oauth/guide/oauth-make-request.html
You should understand how to make request with oauth, first read that and later if you could not succeed, ask again.

Related

Ajax call to Zomato API is not working

I am trying to access zomato api.
URL: https://developers.zomato.com/api/v2.1/categories
Headers: 'X-Zomato-API-Key':'myapikeyhere-763demoapi434'
If I use chrome's postman extension or curl then I can access the url & getting 200 status code.
But if I run it through my angular2 app or simple ajax, it is giving error at preflight OPTIONS request, error code is 501. I have tried otherways too, error is same. Need help
Zomato API's can only be accessed from server to server calls, the error message you have reported is a security policy implemented by Chrome to prevent cross site request forgery on the client side.
A way you can get around this is to write a handler on your server end to make handler which the ajax call will use, this handler in-turn makes a request to the Zomato's server to retrieve the data required.

OpenStreetMap Direct Routing Request via GET error

I have problem with OpenRouteService API (Direct Routing Request via GET described in here http://wiki.openstreetmap.org/wiki/OpenRouteService#Direct_Routing_Request_.28via_GET.29).
My request is:
http://openls.geog.uni-heidelberg.de/route?start=18.609%2C53.02&end=18.749%2C53.49&via=18.01%2C53.12&lang=pl&distunit=KM&routepref=Pedestrian&&weighting=Recommended&avoidAreas&useTMC=false&noMotorways=false&noTollways=false&noUnpavedroads=false&noSteps=false&noFerries=false&instructions=false
(from Toruń in Poland to Grudziądz via Bydgoszcz).
Unfortonatly, I get error:
"validation error: Expected element 'EndPoint#http://www.opengis.net/xls' instead of 'viaPoint#http://www.opengis.net/xls' here in element WayPointList#http://www.opengis.net/xls"
If I put antyhing in "via=" this error appear.
When I change "via=" to empty value:
http://openls.geog.uni-heidelberg.de/route?start=18.609%2C53.02&end=18.749%2C53.49&via=&lang=pl&distunit=KM&routepref=Pedestrian&&weighting=Recommended&avoidAreas&useTMC=false&noMotorways=false&noTollways=false&noUnpavedroads=false&noSteps=false&noFerries=false&instructions=false
all works fine.
Is it problem with my request or api isn't working correctly?
It seems that the frontend API of OpenRouteService receives the GET requests correctly, but after it builds the request in xml and relays it to the backend server the server fails to validate the request correctly. It should be a problem with the backend server.
The frontend php code is here for reference.
The web frontend, which POSTs the xml directly to another backend server, seems to work correctly with via points.

Handling HTTP 302 error and redirecting in Backbone.JS "sync" method

I've got a secured Backbone.js app (that uses Spring security atm.), so a logged-in user must have a valid session-cookie (JSESSIONID). Now, if this session is invalidated (deleted, expired, whatever) and the user attempts to make a request, Spring security will return a 302 Error as an attempt to redirect the user to a login-form.
As is explained in this answer, this 302 response gets handled by the browser (it doesn't reach my app) so what is returned to my app is a 200 OK response with contenttype="text/html" (containing the login form).
Thats an issue, because when my Backbone model attempts to do a sync to a url, it expects JSON. If this sync happens without a valid session, the 200 "text/html" response is returned when "application/json" is expected, giving me a JSON parse error in jQuery.extend.parseJSON.
With great help from this question/answer, I've overridden the Backbone.sync method in order to use my own error handling. However, since the 302 never reaches my error handler I cannot override the redirect myself.
My situation is very similar to this question, however a final solution to the problem was never posted. Could someone please help me figure out the ideal way to ensure a redirect to the login page happens?
Instead of returning the login page with HTTP 200 OK, you should configure Spring Security to return HTTP 401 Unauthorized for unauthenticated AJAX requests. You can detect an AJAX request (as opposed to a normal page request) by checking for the X-Requested-With: XMLHttpRequest request header.
You can use the global $.ajaxError handler to check for 401 errors and redirect to the login page there.
This is how we've implemented it and it works nicely. I'm not a Spring guy, though, so I can't really help with the Spring Security configuration.
EDIT. Instead of custom coockie it will be better to use solution provided by #fencliff.
I think you can use some other field of XHR to detect this situation. A special coockie may do the trick.
You can define your own authentication failure handler from Spring Security side. At the moment when redirect to login page occurs you will be able to add some coockie to HttpServletResponse. Your custom Backbone.sync method will check this cookie. If it is present, it will launch your custom handler for this case (do not forget remove the coockie at the same time).
<sec:http ... >
<sec:form-login login-page='/login.html' authentication-failure-handler-ref="customAuthenticationFailureHandler" />
</sec:http>
<bean id="customAuthenticationFailureHandler" class="com.domain.CustomAuthenticationFailureHandler" />
CustomAuthenticationFailureHandler must implement org.springframework.security.web.authentication.AuthenticationFailureHandler interface. You can add your coockie and then call default SimpleUrlAuthenticationFailureHandler.onAuthenticationFailure(...) implementation.

Unable to create(POST) objects (Account, customer...) on QB Windows using IDS and Sync Manager

Here I am provideing you the complete scenario where I am getting the error while posting request for creating a new account.
I am using Intuit OAuth Access and OAuth API console for testing (Using all security tokens).(https://appcenter.intuit.com/Playground/OAuth)
And the URL and request:
URL: https://services.intuit.com/sb/account/v2/570357960
Method : Post
Format: XML/JSON
Request:
<?xml version="1.0" encoding="UTF-16"?><Add xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" RequestId="4df87bw2-916a-
4r95-h5d6-06dce3667562"
xmlns="http://www.intuit.com/sb/cdm/v2"><ExternalRealmId>570357960</ExternalRealmId><Objectxsi:type="Account"><Name>CurrentAccount</Name><Active>true</Active><Type>Expense<
/Type><Subtype>Expense</Subtype><AcctNum>1111</AcctNum></Object></Add>
And getting the response (error in html):
<div class="content-container"><fieldset>
<h2>500 - Internal server error.</h2>
<h3>There is a problem with the resource you are looking for, and it cannot be displayed.</h3>
and I have also checked with RESTClient utility, but getting the same above error.
Please note that the same url
(https://services.intuit.com/sb/account/v2/570357960) with same
security tokens is working fine for GET data , I am getting data from
QB desktop into my online Application.
As Keith said, check the Content-Type. You will also need to use a RestClient for testing. The playground will not work for testing API calls. It only works for platform calls.
If I had to guess... I'd guess you're sending the wrong Content-Type header... but it's impossible to tell for sure until you post more code/the rest of your HTTP request.
A few things to try. Be sure the XML is in the same order as this sample and try it.
the other is a common mistake when you use Oauth in a GET you are including just the url in the signature, but in a POST you need to include the Body in the signature too or it will not pass Oauth validation.
Lastly, as Keith mentioned to check the content type. Although you would generally get a content type error.
156234822
CurrentAccount
true
Expense
Expense
1111

A simple facebook app gets Method Post is not allowed error

I tried a very simple helloworld example facebook app. Basically I have a webpage, only contains one file index.php, which only contains one line: echo "helloworld". I have registered this app as an facebook app, configured the setting, canvas url to http://mydomain/..
I can load the page mydomain/index.php. However, when I load the page http://apps.facebook.com/appid, I got the following error:
The requested method POST is not allowed for the URL ...
I checked apache config, there is no or settings to prevent POST method.
Apache error log ad access log does not say anything.
Do you have any clue how to fix this?
Thanks for your kind help!
The first request a Facebook app makes is a POST request. It seems your server is not accepting them. A common problem is having something like:
http://mydomain.com/index.html
Instead of
http://mydomain.com/index.php
Either way check your HTTP logs you will probably see an error ( possibly 405 ) with more details.