microsoft-graph-explorer-v4
microsoft-graph-explorer-v4 copied to clipboard
Try It examples where IDs or tokens cause 400 bad request errors
Repro: https://docs.microsoft.com/en-us/graph/api/event-get?view=graph-rest-1.0&tabs=http#request-1
In our demo environment that is used for anonymous (non signed in GE) these snippets will not work. The sample is
https://graph.microsoft.com/v1.0/me/events/AAMkAGIAAAoZDOFAAA=?$select=subject,body,bodyPreview,organizer,attendees,start,end,location
The event-id is the AAMkAGIAAAoZDOFAAA=
part. In some cases in docs it is also {event-id}
.
When you Run Query these will fail with 400 bad request because the AAMkAGIAAAoZDOFAAA=
is not a full length id like AAMkAGVmMDEzMTM4LTZmYWUtNDdkNC1hMDZiLTU1OGY5OTZhYmY4OABGAAAAAAAiQ8W967B7TKBjgx9rVEURBwAiIsqMbYjsT5e-T7KzowPTAAAAAAENAAAiIsqMbYjsT5e-T7KzowPTAACNM9xPAAA=
.
In the docs they are shortened for readability. They also wouldn't be useful anyway as if user is signed in the ids would be different. And we don't have all content in for each workload even in our demo environment. E.g. intune wouldn't return anything in our demo environment as not even configured, so users need to sign in. The docs v-team state that this is A LOT of work and that for now the plan would be to address this issue based on current state.
We are aware of this experience issue and auto-suggest will help here when we get to this feature. As it can reverse engineer knowing it needs a event-id and call /me/events and pick the first result and use its id. This should be tracked as an additional work item.
In the near term, can we at least investigate pattern matching any tokens in request urls e.g. {event-id}
and format them in the textarea rendered on the screen. To make it obvious that they need to supply an event-id. E.g. make the background of {event-id}
or AAMkAGIAAAoZDOFAAA=
text in bright yellow and bold.
Can we also if they do Run Query, that we show a helper box that tells them that the reason they got this is because they need to update the url (or request body) to ids and values that are in their environment. We could provide the get event example as explanation in that text.
We could also disable the Run Query button if there are {event-id}
type things in the url.
Other examples
{id}
two diff ids {teams-id} (channel-id} - https://docs.microsoft.com/en-us/graph/api/channel-get?view=graph-rest-1.0&tabs=http
{id | userPrincipalName}
https://docs.microsoft.com/en-us/graph/api/user-get?view=graph-rest-1.0&tabs=http#example-3-users-request-using-select
{idOrUserPrincipalName}
https://docs.microsoft.com/en-us/graph/api/drive-get?view=graph-rest-1.0&tabs=http#http-request-1
{school-id}
https://docs.microsoft.com/en-us/graph/api/educationschool-get?view=graph-rest-1.0&tabs=http#request
AAMkAGIAAAoZDOFAAA=
- not a token a sample id (i don't know how we'd find these) - https://docs.microsoft.com/en-us/graph/api/event-get?view=graph-rest-1.0&tabs=http
We could actually get real smart
# [HTTP](#tab/http)
<!-- {
"blockType": "request",
"name": "get_educationschool",
}-->
```msgraph-interactive
GET https://graph.microsoft.com/v1.0/education/schools/{school-id}
and add a new attribute to the comments below the blockType and name here and get the docfx team to send this through to Graph Explorer. We could then get the doc writer to provide the api call to get things like the school-id based on a graph query or even just provide helper text.
like
"helpText":"To get a {school-id} you can run https://graph.microsoft.com/v1.0/education/schools",
"autoComplete":{ "school-id", "https://graph.microsoft.com/v1.0/education/schools" }
We could also disable the Run Query button if there are
{event-id}
type things in the url.
We have a function that replaces placeholders like {event-id}
with the correct input in both try it and full GE.
I believe this closes this? @bettirosengugi
@thewahome The idea is to discover instances in docs where we have IDs shared, then replace that with {Insert Id here} or any other tip to show there's more data required to run that query.