I am not sure how to create the request URL if I want to utilize Mapquest Route Matrix
http://open.mapquestapi.com/directions/#common
This worked great for me.
http://open.mapquestapi.com/directions/v2/routematrix?key=KEY&json={locations:[{latLng:{lat:54.0484068,lng:-2.7990345}},{latLng:{lat:53.9593817,lng:-1.0814175}},{latLng:{lat:53.9593817,lng:-1.0514175}},{latLng:{lat:53.9593817,lng:-1.0114175}}],options:{allToAll:%20false}}
Related
Is REST url link and normal url like looks same how to know the REST operations
I'm trying to understand what is difference between REST and URL...?
Hi Guys need your help.
I am creating an Image via docker REST API.
The link mentioned for parameter fromSrc following is the description :
fromSrc: Source to import. The value may be a URL from which the image can be retrieved or - to read the image from the request body. This parameter may only be used when importing an image.
if anyone can suggest the meaning of to read the image from the request body part and how we can test this
to read the image from the request body
means that you have to put your image as Json into the body of your request.
The URL, in this case, will look like this '.../images/create?fromSrc=-'
To test this, you can use Restlet client or Postman, which are chrome extensions that let you build a request with a body.
We are getting neither price nor image urls from magento soap api calls catalogProductAttributeMediaList and catalogProductGetSpecialPrice.
can anyone help me please?
when requesting catalogProductAttributeMediaList you will get array of stdObject's with following properties:
file
label
position
exclude
url
types
if not, please post your api response to get further advice
I have created a class that generates a URL that authorized my users with Facebook. Here it is:
https://www.facebook.com/dialog/oauth?response_type=code&client_id=...&scope=email%2Cuser_about_me%2Cuser_friends%2Cuser_hometown%2Cuser_location%2Cuser_work_history%2Cuser_education_history%2Cpublish_actions&state=...&redirect_uri=http%3a%2f%2flocalhost%3a53016%2fsocial%2fcallback%3fvariables%3dY2FsbGJhY2tfdXJsOi9MYW5kaW5nO2ZhbGxiYWNrX3VybDovQ29uc3VsdGFudC9TaWduVXA7bWV0aG9kOjE7cHJvdmlkZXI6MQ%3d%3d
This URL works just fine and returns back to my callback function. I'm able to convert the base64 string to my variables that I pass along with my URL. The trouble that I am facing is that Facebook doesn't recognize the URL to give me the access_token. This the return URL that I send to Facebook for the access_token.
https://graph.facebook.com/oauth/access_token?client_id=...&client_secret=...&code=...&redirect_uri=http%3a%2f%2flocalhost%3a53016%2fsocial%2fcallback%3fvariables%3dY2FsbGJhY2tfdXJsOi9MYW5kaW5nO2ZhbGxiYWNrX3VybDovQ29uc3VsdGFudC9TaWduVXA7bWV0aG9kOjE7cHJvdmlkZXI6MQ%3d%3d
(I have cleared out the client_id and client_secret for obvious reasons.)
Can anyone notice what I am doing wrong here?
Perry thank you for your help. I was able to figure out what the problem was on my project. When I was encoding my parameters to Base64 I wasn't using the proper methods to convert it to String. This answer on stackoverflow helped me figure out what I was doing wrong.
C# Method like Base64String, but only alphanumeric (no plus or slash)
The answer in particular is from Mason G. Zhwiti. I was just doing Convert.Base64String instead of HttpServerUtility.UrlTokenEncode(byte[] b). After I did that I was able to get my response. I seemed that my URL had two equal symbols at the end. That was throwing off Facebooks URL validation. Once I did the appropriate method it started working.
I hope this helps anyone else who is struggling with this type of problem.
What is the specific error message - was it unauthorized redirect_uri?
I'm kind of oblivious to the variables - what are they for?
It doesn't seem like you should be doing the callback to a querystring URL, but maybe that's OK. When I first implemented OAuth2, I had the API calls originate from and callback to specific URLs for each provider, such as mysite.com/login-google.php or mysite.com/login-facebook.php, but now I have the callbacks point to the main site URL (mysite.com). Since we have index.php at the main site URL, we can intercept the callback in index.php and route them to the desired provider script (login-google.php or login-facebook.php) which cleans up the callback URLs and makes them a no-brainer for end-users to work with.
Your callback URL:
http://localhost:53016/social/callback?variables=Y2FsbGJhY2tfdXJsOi9MYW5kaW5nO2ZhbGxiYWNrX3VybDovQ29uc3VsdGFudC9TaWduVXA7bWV0aG9kOjE7cHJvdmlkZXI6MQ==
Can you access that callback URL in a browser? Code it up to throw an error or output a debug message so you know the callback URL is working.
I've documented the OAuth2 flow for Facebook quite cleanly in this code: https://github.com/perrybutler/WP-OAuth/blob/master/login-facebook.php
Hope it all helps...
Imagine I am creating an API to allow a user to attach an image to their profile, where the image may come from a binary submission in the body, or a url, which the server will retrieve and process.
Assuming the API expects a PUT with binary image data to
/user/jon/image
When adding the URl functionality, which of the following would be preferable?
A:
PUT to /user/jon/image/url
passing the url in the body
or
B:
PUT /user/jon/image/
passing in a url in the body and setting a MIME type to advise the host whether or not the content is an image or an URL?
Is there a standard way of dealing with this situation? I feel that using MIME types to dictate the payload is more semantically correct, but a little less discoverable
Thanks
Once I had this same problem. I solved it by first posting the image by "PUT /user/jon/image/" and then posting the URL with PUT to /user/jon/image/url.
The problem is, that the user posts an image and forgets about the URL. I solved this by saving the image temporally in a session and when the URL is posted, I saved the URL and the image at the same time.
Problem is, this is not Restful, because a restful server doesn't have sesions. But being 100% restful is almost imposible, so its your choice.