Godaddy api gives empty array as response when tested in postman - javascript

I am trying to hit the godaddy api for looking the list of domains with the expected search as below,
Postman image edited
it gives me an empty array as response. Please help, M i doing some wrong in hitting this?

Status is 200 so your authentication was not a problem.
Check your params again to make sure you are passing them correctly. I see a param: marker: clothing' that might have a missing quote.

Related

Can you use a POST to GET data?

A company is asking me to do an Angular assignment. They provide the following instructions, but the API URL doesn't work:
Create a single page angular application and use the following API to retrieve sports results and sort into a table of results that are displayed. Each sport result contains several data and always includes the publication time.
Method: POST
Content-Type: application/json
Url: https://ancient-wood-1161.getsandbox.com:443/results
Tasks:
-Display the sports results in reverse chronological order on the page.
-Add a filter to the page to display only certain types or events (e.g. f1Results)
-How can you confirm the code works?
-Bonus: Implement the rest call asynchronously
You can click the URL https://ancient-wood-1161.getsandbox.com:443/results right now and see that it doesn't work - it returns {"errors":[{"message":"Error processing request"}]} and in Angular it gives me a standard CORS error.
I asked the company to please send a working URL and/or update the API to accept requests from everywhere. Their response was:
*guy's name* confirmed it worked. It is a post and the content type is json.
Can you use a POST request to GET data?
Absolutely. Take for example your avg Login Request that returns an access token for instance. It is going to be a POST as POST also has a bit more security than GET given that the payload is in the body rather than the URL string.
As for their excuse of it not working, try it in postman and see if the same issue still occurs. If it still does then ask them where did they test their API as if it is on prem then no duh the CORS would work. It is most likely not a company you would want to work for.
Yes, you can. On some cases it may be necessary, since GET doesn't take a body while POST does. So it can get you around things like URL length limits.

API URL Help needed

I'm looking for some help and wasn't sure where to go for it. Was hoping someone more knowledgeable could give me some quick help. I'm trying to use an Api to get Hearthstone card game data and I have the end point which is
"https://omgvamp-hearthstone-v1.p.mashape.com/cards"
2:28 pm
And I have my API key which is "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" And I can't figure out how to string it all together into a single URL that will return data.
I've been trying things along the lines of "https://omgvamp-hearthstone-v1.p.mashape.com/cards?x-mashape-key=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
But nothing's giving, any ideas if anyone has some free time?
You need to have x-mashape-key in your request headers rather than in the query string, according to their API take a look at the CURL request:
https://market.mashape.com/omgvamp/hearthstone
Try going here: http://requestmaker.com/ filling in the URL leaving out the last part of x-mashape-key and add a request header with key/value of x-mashape-key:XXXXXXXXXXXXXXXX then hit request and you should get a response.

Facebook js APi, fetching photos without permissions returns empty array instead of error

I'm trying to get a user's photos via Facebook's JS API ('/me/photos' and '/me/photos/uploaded').
If I have he user_photos permissions it all works well, but when I don't I just get an empty array back instead of an error (which makes it a bit hard to distinguish between user's with no photos, and missing permissions).
From https://developers.facebook.com/docs/facebook-login/permissions/v2.0 is seems like an error should be returned.
Am I missing something?
Thanks
Yaron

$.getJSON on chrome extension fails to work properly

I'm creating a chrome extension, and want to be able to get a profile picture from a username. Unfortunately, there isn't an api for the website and there is no correlation between the profile URL and the profile name. I figured I could hijack the search ajax and use it to achieve my goal. Unfortunately, it doesn't seem to be working. I've added the permissions, and it isn't running in a content script, but it's still not working.
$.getJSON("http://www.website.com/user/search",{user:name},function(a){
alert(1);
alert(a.data);
});
It's failing silently, as nothing is happing. Yet, I can't figure out why.
The json I should be receiving from the call (browsed to the site manually) is:
{"error":false,"action":null,"one":true,"data":143217}
Unfortunately it's not working. JSONP isn't an option, as the site obviously has no need of supporting it, so help me please. I don't see what I'm doing wrong.
EDIT: I see the problem. When I try to do the request I'm being redirected to user/search ( no ?user) which fails.
The site you're trying to reach requires authentication before allowing a search to occur. You won't get a response from your ajax request, because the server is looking for a session with login credentials to allow the search to happen. Because your ajax is not authenticated, and does not have the session established, your request doesn't "fail", it is simply getting the server's 302 redirect response.
You would need to 'sign in' to the page you are trying to query in order to establish the session and any necessary variables before you would be able to proceed with your user search.
It could be entirely possible that the website's search API isn't returning the Content-type header as text/json, which is required for $.getJSON to function correctly.
Try simply using $.get and calling JSON.parse on the returned data.

Facebook returns empty data attribute when publishing Open Graph action

I am trying to integrate the new Open Graph objects, actions and aggregations into our site.
I have:
Created an object and an associated action
Added the correct markup to my page
Verified the markup from #2 is valid in the Facebook Debug tool
When trying to submit the action for approval, it tells me I need to publish the action at least once. I tried doing that using the following request as in the documentation:
https://graph.facebook.com/me/<my-namespace>:<my-action>?<my-object>=<url-to-object>&access_token=<my-access-token>
The response didn't give me any errors but responded with an empty data attribute.
{
data: [ ],
paging: {
next: "<paging-url-here>"
}
}
I thought that perhaps the empty data in the response was indirect way to tell me it succeeded but when I look at my profile the action wasn't published, nor will Facebook let me submit the action (they still tell me I need to publish the action at least once).
I've verified the access token is valid, and in fact, I messed with it by removing a few characters and the request fails telling me the access token is invalid.
I'm obviously missing something obvious here, so would love some help!
Facebook has a bug making GET behave differently than POST. If you're experiencing the same problem I am and using a GET, switch to a POST and it should work.
That should work. Please file a bug at developers.facebook.com/bugs for what you're specifically seeing and we'll investigate.

Categories

Resources