I’m trying to use the Realm Administration API and I can call the base endpoints like create an access token and get a list of applications. But when I take any of the application ids (from the _id field) they all return 404 Not Found for all endpoints.
I gave the API key I set up all the permissions available.
Hi All – In addition to the code snippet that Ian mentioned, it would also be helpful to confirm that you’re following the steps for an Atlas Programmatic API key and that the key has project owner permissions for the project where your applications are. Sounds like this is the case, but sometimes we see confusion between Atlas API keys and Realm’s API key authentication.
Hi @Ian_Ward and @Drew_DiPalma, if someone would have reached out to this ticket 4 months ago when I posted it I might have been able to oblige, but I can’t even remember why I needed to use that endpoint now, so unfortunately I can’t help.
Sorry about that @Max_Karlsson - we don’t really have a SLA governing our community forums but in the future you can always open a support ticket which does have a SLA tracking system in place.
For this specific issue, we don’t see any reason why this wouldn’t work so likely there is just some confusion in the implementation. Would love to clean this up in the docs but we would need to know what is not clear in order to fix it.
Sorry, @Ian_Ward I didn’t mean to come across as entitled. I realise that this is just the community support forum. I just wanted to point out that the time that’s passed since I posted this question is too long for me to remember what I was trying to achieve or how. I don’t even remember which documentation I used, but I know I followed it to a tee
Perhaps @varyamereon will be better equipped to answer since he’s worked on it more recently.
@Drew_DiPalma re-reading the instructions I have found out what I was doing wrong. The call to get an access_token was always successful. I was then making calls with Postman and adding the token to the Authorization like so:
This was always returning 404 Page not Found. This morning I copies the curl request and replaced with my access token. It’s added to the headers in a different way and I was able to successfully make requests this way:
The 404 error can happen if you copied the API path by highlighting the string from the documentation instead of using the copy icon. Doing so can lead to copying across hidden UTF characters which will cause this issue. Please use the copy icon as shown below to avoid this issue.
I, too, am running into this issue. @Drew_DiPalma , I see that you mentioned following the steps for an Atlas Programmatic API key. The only thing that I found different was the lack of a configured access list. I went ahead and configured that and was still met with a 404, “app not found” message. It’s also worth noting that the docs for the access list mention the following: “An empty API access list grants access to all API endpoints except those that explicitly require an API access list.” When viewing the Admin API docs page, I see no reference to anything about the access list. I therefore assume that there are no endpoints that require said access list.
The API key has organization member and organization read only roles assigned. At the project level, the key is a project owner.
I’m simply trying to hit the /logs endpoint to see what data they actually return. I’m using Postman for these requests. I’ve also tried with curl and was met with the same message.
The realm-cli, using the same key, has no issue with dumping the logs, but the info is just not helpful as there are no details about the individual log event beyond the type and if it was an error or OK.
Hi Justin – Would you mind posting/messaging the API request that you’re making (minus any sensitive information) this could help debug here as the above doesn’t point to any specific issue.
Sure thing. There’s not really anything crazy. It’s really just the standard API endpoint: curl --request GET \ --header 'Authorization: Bearer <access_token>' \ 'https://realm.mongodb.com/api/admin/v3.0/groups/{groupId}/apps/{appId}/logs'
As others have said, I, too, can get a valid response from: curl --request GET \ --header 'Authorization: Bearer <access_token>' \ https://realm.mongodb.com/api/admin/v3.0/groups/{groupId}/apps
My issue has been resolved. (Thanks, Drew!) It’s important to note that the {appId} in the API path is NOT the client App ID. The docs specifically say this in this section. In my case, I was passing client_app_id and not the _id that was returned from the call to https://realm.mongodb.com/api/admin/v3.0/groups/{groupId}/apps.