When I try to get JSON from this URL :
http://gdata.youtube.com/feeds/api/users/user/favorites?v=2&alt=jsonc&max-results=1
I get this message :
{"apiVersion":"2.1","error":{"code":403,"message":"Not allowed.","errors":[{"domain":"GData","code":"ServiceForbiddenException","internalReason":"Not allowed."}]}}
Any ideas?
Thanks for help.
Update :
I already made all video as public. This is my real URL :
http://gdata.youtube.com/feeds/api/users/ptiundiksha/favorites?v=2&alt=jsonc&max-results=1.
I also try to get uploads channel, and it's only return an empty array.
http://gdata.youtube.com/feeds/api/users/ptiundiksha/uploads?v=2&alt=jsonc&max-results=1
I think in that URL, where it says user, you need to replace that with a valid YouTube username.
The error message (code":403,"message":"Not allowed."), means that the "user" is keeping his favorites list PRIVATE. It only works if the "user" makes it PUBLIC or if you also provide an access_token.
Note, that API V2 is deprecated.
Update 9-25-2013:
When i try your url "http://gdata.youtube.com/feeds/api/users/ptiundiksha/favorites" the result is: "Not allowed.". This means you have made this list private. You can set this list to PUBLIC by unchecking the check-box "Make this list private" in https://www.youtube.com/my_favorites (when you are signed-in to YouTube). And assuming you have some videos in your Favorites list which are also public.
When i try your url "http://gdata.youtube.com/feeds/api/users/ptiundiksha/uploads?v=2&alt=json" i do get a result. the response shows that there are 56 videos in that list. If you get an empty list there could be something wrong in your code.
Related
I want to validate file. While file is invalid, i want to refresh my page and inform user that he did not upload proper file. So i have this in my
views/campaign.py
try:
wb = load_workbook(mp_file)
except BadZipfile:
return redirect('campaign_add', client_id)
The only way i know how to do it is add another attribute to client class which will be
is_error(models.BooleanField())
And then change views/campaign to
try:
client.is_error = False
wb = load_workbook(mp_file)
client.save()
except BadZipfile:
client.is_error = True
client.save()
return redirect('campaign_add', client)
And with another attribute i can add in my campaign.html file some kind of if is.error is true i'm adding some kind of windows with information about bad file after reloading page. But is there any way to do it without adding another attribute?
Ok, let's imagine that the answer is a little bit complicated than you've expected.
Modern UI's are not reloading pages just to inform about some errors with user input or upload.
So what is the best user experience here?
User is uploading some file(s) from the page.
You are sending a file via JavaScript to the dedicated API endpoint for this uploading. Let's say /workbook/uploads/. You need to create a handler for this endpoint (view)
Endpoint returns 200 OK with the empty body on success or an error, let's say 400 Bad Request with detailed JSON in the body to show to the user what's wrong.
You're parsing responses in JavaScript and show the user what's wrong
No refreshes are needed. 🙌
But the particular answer will need more code from your implementation. (view, urls, template)
How I can solve this issue in post man tired documentation but couldn't find any useful resource please help??
This error occurs in the Student Expert training, when verifying whether you have completed all of the tasks that were requested. Specifically, it relates to this element of the Get specific player request:
Before you continue with scripting, add a description to this
request—the description will appear within the collection
documentation, which you would use if you were e.g. publishing an API
for public use. In the Postman app, at the top of this request tab, to
the left of the request name, expand and and click to edit. Add a
short description of the request (you can use markdown) and click
Save. If you're using the web version, use the little documentation icon to the right of the request.
The test is looking at the Get specific player endpoint and checking whether a description has been set: expected [description] to have a length above 0 but got 0. If you add a description, save, and regenerate your public collection share link, the test will pass.
I've been looking for an exact explanation of how to get and use access tokens for public pages.
I'm trying to list the events for a public page, then grab all the event IDs and make another call to each ID, then send the complete list somewhere (I will handle that, I just need access to the JSON information for each event, which I can't). The following works for me:
https://graph.facebook.com/pages/PAGEID/events?accesstoken=ACCESSTOKEN
And gives me a list of all the events - when, title, where etc. But if I try to do:
https://graph.facebook.com/events/EVENTID/?accesstoken=ACCESSTOKEN
I get an error 100 - why is this? Shouldn't this work? All the events are public, and since fetching the page's events works, it shouldn't be because of a restriction (alcohol, location etc) I assume?
The ID should be used directly after the facebook URL, like:
https://graph.facebook.com/EVENTID?access_token=ACCESSTOKEN
In Box API v1, it was possible to request creation of a shared link for a file or folder, without caring about what kind of sharing was required. In fact, it was not possible to ask for a particular type of share - you just used the public_share method and passed in the target type (file/folder) and target ID, and optionally a share password. In an Enterprise Account, for instance, this might result in the maximum access level being "company" or "collaborators", if public links are disallowed.
With Box API v2, according to the docs here, you need to specify an access parameter that has to be "open", "company", or "collaborators".
The problem is, using the wrong type may cause the share to fail. For instance, in a folder/account that only allows collaborators, I get a 400 error if I ask for a "open" share.
What I really want is to get exactly the same result as if the user clicked the "Share" link in the Box web site. Which is, it should enable sharing for the file but default the level appropriately.
Is there a way to do this with v2, without the admin having to tell us their "preferred" access level for shared links we create? I'm using the Java SDK, like this:
BoxItemRequestObject req = BoxItemRequestObject.createSharedLinkRequestObject(BoxSharedLinkRequestObject.createSharedLinkRequestObject("open"));
BoxItem item = itemsManager.createSharedLink(<ID>, req, BoxResourceType.FILE);
Thanks,
Ben Gilbert
Smartsheet.com
Just set the access to the empty set {}
So your request would look like this:
{"shared_link": {}}
I figured out how to make this work. I need to set access to null when creating the BoxSharedLinkRequestObject, like this:**
BoxItemRequestObject req = BoxItemRequestObject.createSharedLinkRequestObject(BoxSharedLinkRequestObject.createSharedLinkRequestObject(null));
This doesn't produce quite the same JSON as was recommended (shared_link: {}), but it does produce JSON that is apparently equivalent: shared_link: { access: null }. I couldn't figure out any way to produce an empty shared_link object using the SDK -- I either had to have a null shared_link (which didn't work at all) or some value for the access field.
I'm calling my account's album with the URL in following form:
https://picasaweb.google.com/data/feed/api/user/<user_id>/albumid/<album_id>
This returns an ATOM feed with this URL:
https://picasaweb.google.com/data/feed/api/user/<user_id>/albumid/<album_id>/?alt=json
I get "No album found." error.
Do I have to set up JSON in my account's preferences? Because the method I'm using seems like the proper one - according to the documentation: https://developers.google.com/gdata/docs/json
This: https://picasaweb.google.com/data/feed/api/user/103168604032363426774/albumid/5626814518240219937?alt=json works. It seems like the album you're using doesn't actually exist.
Can you share the URL you're actually using?
Just share album as public.Got to album settings , visible for everyone in the internet