How to fix error: "The URI segment 'notebooks' is invalid after the segment 'notes'" - onenote

I'm trying to get information about a OneNote notebook that is stored in CRM. Using the CRM api, I can fetch OneNote notebook ids, which I should be able to send to the OneNote api to get its contents. However, when I send a request I get the error: "The OData query is invalid. The URI segment 'notebooks' is invalid after the segment 'notes'."
I have to request a Bearer Access token, and I made an application which has the permission: Notes.Read.All, which should enable me to have access to read OneNote books across the organization.
The following url seems to say that my request should be valid syntax. Perhaps I'm using an incorrect site id or something?
https://learn.microsoft.com/en-us/graph/api/onenote-list-notebooks?view=graph-rest-1.0
The bearer token is able to fetch information about a user's specific OneNote books with no issues, but I need to be able to fetch by the site where they are stored.
My request looks like the following (numbers and letter placed by me):
GET: https://graph.microsoft.com/v1.0/sites/aaaaaaaa-5555-4444-bbbb-g7g8g9g10/onenote/notebooks

Site Id has to be specified in a 3 part (separated by 2 commas) like format. See it's documentation at: https://learn.microsoft.com/en-us/graph/api/site-get?view=graph-rest-1.0
Thanks!

Related

Getting 404 Error While fetching MetaData of BIM360 Model using Forge SDK API

i am trying to get Model Strucuture data of BIM360 Model That we store, for that i'm using metadata api passing threelegged Token, model urn, model guid, but getting 404 (Not Found Error). i tried for get model that we store in our bucket that we are getting from this api, but that model we stored in BIM360 Accounts for that API is giving Error of NOT Found,
i have passed all scope, backet:read, data:Read etc. couldn't getting result.
Thank you
It's a bit difficult to guess what's wrong with the limited information but generally, the 404 Not Found error would indicate that something in the URL (of the request made by the derivativesApi.getModelviewMetadata method call) is missing or wrong.
I'd suggest to look at the following:
Could you take the URN, GUID, and access token, and make the request to the GET {urn}/metadata/{guid} endpoint directly using some 3rd party client application such as curl or postman?
If this returns 404, there might be some issue with the actual URN and/or GUID
If this works, there might be some issue in your code
What Forge SDK exactly are you using, and for what language? Is it one of the official SDKs, or is it a 3rd party one?
Are you sure you're passing in the right parameters to the derivativesApi.getModelviewMetadata method call?

Autodesk Forge accessing b360 hub to get projects - error 404

I'm trying to pubhlish a project using this guide - https://forge.autodesk.com/en/docs/data/v2/tutorials/publish-model/
I am able to get the docs hub ID for the expected hub (using 3 legged token, after having Autodesk provision the b360 docs account, and setting up integration w/ forge app), and pass this into the call to get the projects (using same token, or new token) using this guide - https://forge.autodesk.com/en/docs/data/v2/reference/http/hubs-hub_id-projects-GET/
I get back a response 404 error using the hub ID provided in the GET hubs call that starts with b.xxx from the GET hubs
{
"developerMessage": "The requested resource does not exist.",
"moreInfo": "https://forge.autodesk.com/en/docs/oauth/v2/developers_guide/error_handling/",
"errorCode": ""
}
I've tried this with a. as well, instead of b. and also no prefix on hub ID with no luck. I verified that this Id matches what is shown in the account admin settings online as well.
The get request looks like this, and includes authorization token in format Bearer {{token}} where {{token}} is the (same) variable for the token that works when getting hub ID's.
https://developer.api.autodesk.com/project/v1/hubs/b.e3a26052-6b48-4a03-9115-xxxxxxxxxxx/projects
Is my format incorrect, or is there something else going on?
The request looks ok, incl. the hub ID (the b. prefix must be there). One thing to check for is whether the actual user you're using to obtain the 3-legged token has access to any projects inside this hub.
Also, what happens when you try the GET hubs/:hub_id endpoint? Can you see the hub information or do you get 404 as well?

Where to put access token in Reddit API url?

I'm trying to use the reddit api in a practice app to practice parsing JSON in Swift, and I've registered to get an access token, but now I'm confused as to where to put it. In other APIs I've used, I'd just put the access token string (?) somewhere in the endpoint url and that would be it, but I can't see anything pertaining to that in the documentation. For example if I'm trying to access https://api.reddit.com/api/v1/top/, where would I add my access token?
In the OAuth documentation is says to use the url https://www.reddit.com/api/v1/authorize?client_id=CLIENT_ID&response_type=TYPE&
state=RANDOM_STRING&redirect_uri=URI&duration=DURATION&scope=SCOPE_STRING but that seems to need:
CLIENT_ID
RANDOM_STRING
URI
DURATION
SCOPE_STRING
I plugged in all the necessary values according to the documentation, and it redirected me to the front page of reddit (I gave https://www.reddit.com/ as my redirect uri)
In previous practice apps with other APIs, I would simply have a single url (that included my auth token) and I'd plug that url into my function that parses the data. Now that I've followed the OAuth directions, I still can't seem to find an endpoint url that I can use in my app.
I tried https://api.reddit.com/api/v1/top in my browser and it says {"message": "Unauthorized", "error": 401}, and I tried https://www.reddit.com/api/v1/myAccessToken where myAccessToken is the string they gave me when I registered. This leads me to a "page not found" on Reddit.
What do I need to do here to get a basic endpoint url that gives me the JSON data for, just for example, recent posts?

gmail API : Cannot access the list of messages I requested

So what I'm trying to do is to fetch data from gmail API using unix's shell (curl).
I simply copied this from the json generator to be able to play with the json when I used with curl.
GET https://www.googleapis.com/gmail/v1/users/somebody%40gmail.com/messages?
maxResults=5&includeSpamTrash=false&key={YOUR_API_KEY}
Then I changed the API_KEY by what I was able to generate in my developer console. However, I cannot get the desired json when I put the link in my browser, or curl it in my shell. How do I generate the right key? Because I already generated from all of the choices in the Credentials.
Thanks!
What you generate in the Console is the Client ID and Client secret, which are used when you redirect your users to Google. Upon accepting, Google then redirects the user to the url you specify in the console with a code. This code is then finally used to retrieve the Access Token which you should use as {YOUR_API_KEY}.
Go to Google OAuth 2.0 Playground, and use the Gmail API v1 scopes, and retrieve the access token and use it in your shell.

Graph API: User Access Token

I'm trying to use the Graph API to get the feed of multiple public groups then that of multiple users.
When it comes to the feed of groups, it works flawlessly, all I have to do is fetch the following :
graph.facebook.com/$group_id/feed?limit={feedLimit}&access_token={access_token}
My access token being comprised of: AppID|AppSecret
However when it comes to fetching the feed of a user (Whose confidentiality settings are set to public of course) all I get is an empty answer. I would've thought it impossible to get such info and stopped there but then I stumbled upon ApiGee. All I have to do then is authenticate as a user (facebook-Authenticated-user) and it works.
Here's an image of it: http://s9.postimg.org/ynq5tar9r/feed.jpg
My question is : "How is that possible? I've read all I could in the docs and I still can't understand how it works. And how can I remedy that?"
Thank you.
The token you are using is an App token (AppId|AppSecret). With the app token you can't really get users personal feeds. With ApiGee you authenticated to get a user token, which can be used to fetch posts on the authenticated user's feed.
Read more about Facebook's access tokens