Issue: While Inviting user/Add permission to Item,Getting 400 with message - The request is malformed or incorrect. This was worked earlier and stopped working now.
Article: https://learn.microsoft.com/en-us/onedrive/developer/rest-api/api/driveitem_invite
Post URL :
POST /v1.0/me/drive/items/01B6CXZGZ7RGHIXZBXKNCZB747AVB52EQ2/invite HTTP/1.1
Host: graph.microsoft.com
Connection: keep-alive
Content-Length: 213
Pragma: no-cache
Cache-Control: no-cache
Accept: application/json, text/plain, /
Origin: https://developer.microsoft.com
Payload :
{
"recipients": [{ "email": "ryan#contoso.com" }],
"message": "Here's the file that we're collaborating on.",
"requireSignIn": false,
"sendInvitation": true,
"roles": [ "read" ]
}
Response:
{
"error": {
"code": "invalidRequest",
"message": "The request is malformed or incorrect.",
"innerError": {
"request-id": "c8a02a02-299c-4ace-8e40-dbd6f830d9ba",
"date": "2018-05-17T11:38:00"
}
}
}
PD: We also have tested the beta version of the graph api, and the response is the same than with the v1.0
It seems after some days without working, this afternoon they have restored the service and now it works again
Related
We have a new problem when run this request: https://learn.microsoft.com/en-us/graph/api/channel-get-filesfolder?view=graph-rest-1.0&tabs=http
That is, GET /teams/{id}/channels/{id}/filesFolder
Previously, if a Team Channel was created via the API, it wasn't linked to a folder with files, until a user clicks Files in a Teams client and thus initializes it. And until it was initialized, the request would return Not Found 404.
However, since around February 25, 2021, in case the authenication uses MFA, we now get this error: Value cannot be null. Parameter name: token. But, the Authorization Token is present in the request as we verified with a traffic capture. Once you initialize the folder by clicking Files, the request starts to return valid data.
Is this a bug? Thanks.
GET https://graph.microsoft.com/v1.0/teams/.../channels/.../filesFolder?$select=id,name,webUrl,parentReference HTTP/1.1
Content-Type: application/json
User-Agent: <...>
Authorization: Bearer ...
Host: graph.microsoft.com
Connection: Keep-Alive
HTTP/1.1 400 Bad Request
Cache-Control: private
Content-Type: application/json
request-id: ...
client-request-id: ...
x-ms-ags-diagnostic: {"ServerInfo":{"DataCenter":"West Europe","Slice":"SliceC","Ring":"5","ScaleUnit":"005","RoleInstance":"AGSFE_IN_67"}}
Strict-Transport-Security: max-age=31536000
Date: Mon, 01 Mar 2021 19:38:40 GMT
Content-Length: 310
{
"error": {
"code": "BadRequest",
"message": "Value cannot be null.\r\nParameter name: token",
"innerError": {
"date": "2021-03-01T19:38:41",
"request-id": "...",
"client-request-id": "..."
}
}
}
We have Raised a Bug. We don't have ETA to share when it will be available.
I'm trying to create a sharing link for OneDrive item using Microsoft.Graph.CreateLink action:
POST https://graph.microsoft.com/v1.0/me/drive/items/01B642VZR4QM6MX36HGZELNLHCFGY26JJ6/Microsoft.Graph.createLink HTTP/1.1
Authorization: Bearer {access_token}
Content-Type: application/json
{
"type":"edit"
}
and I got the following error:
HTTP/1.1 400 Bad Request
{
"error": {
"code": "BadRequest",
"message": "Version not specified.",
"innerError": {
"request-id": "3ca90464-3910-49e1-92f2-3a9daa822944",
"date": "2016-02-17T15:56:16"
}
}
}
Either method description or metadata does not contain any information about versions needed other than in the API endpoint.
From logs corresponding to request-id:3ca90464-3910-49e1-92f2-3a9daa822944, the request received by the service was "POST https://graph.microsoft.com/". The lack of path segment in the request URL is causing this expected error. Can you please check the request again?
I am trying to learn OAuth 2.0 by walking through walking through making Google API call using Firefox 28.0 and REST Client v2.0.3.
I went to the Google Developer OAuth 2.0 Playground site.
I signed in using my Google credentials
Selected "Calendar API v3" .readonly
clicked the "Authorize APIs" button
Then I clicked "Exchage authorization code for tokens" and got the access token ab31.4.CDEfG_HI1JkKMNoPQR5S9tuvW_x2yzabcDEFGhiJklMnOpqRs-T6uvwXyza5BcdEFGHiJK3L
From the Calendar API, I use the URL https://www.googleapis.com/calendar/v3/users/me/calendarList wtih the GET HTTP action
In RESTClient I create a header with the name "Authorization" and set the value ab31.4.CDEfG_HI1JkKMNoPQR5S9tuvW_x2yzabcDEFGhiJklMnOpqRs-T6uvwXyza5BcdEFGHiJK3L to the from "Access token:" box from the OAuth 2.0 Playground.
With an empty Body I click SEND and I get an authorization error (the playground says my token is still valid for another 30 minutes)
The error's header is:
Status Code: 401 Unauthorized
Alternate-Protocol: 443:quic
Cache-Control: private, max-age=0
Content-Encoding: gzip
Content-Length: 162
Content-Type: application/json; charset=UTF-8
Date: Tue, 18 Mar 2014 19:17:35 GMT
Expires: Tue, 18 Mar 2014 19:17:35 GMT
Server: GSE
WWW-Authenticate: Bearer realm="https://www.google.com/accounts/AuthSubRequest"
X-Content-Type-Options: nosniff
X-Firefox-Spdy: 3.1
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block
and the body is:
{
"error": {
"errors": [
{
"domain": "global",
"reason": "authError",
"message": "Invalid Credentials",
"locationType": "header",
"location": "Authorization"
}
],
"code": 401,
"message": "Invalid Credentials"
}
}
The header needs to be set to Authorization: Bearer ab31.4.CDEfG_HI1JkKMNoPQR5S9tuvW_x2yzabcDEFGhiJklMnOpqRs-T6uvwXyza5BcdEFGHiJK3L. You need the word "Bearer" preceding the token.
the problem is fairly simple, I cannot make a very simple request to youtube api video.update without getting a 400 response with a reason 'invalidRequest'. I'am using Youtube API Explorer (https://developers.google.com/youtube/v3/docs/videos/update). The account is authorized. Other API methods such as playlists.update and videos.list works just fine. Please help with this video.update request.
Test request sent:
PUT https://www.googleapis.com/youtube/v3/videos?part=snippet&key={YOUR_API_KEY}
Content-Type: application/json
Authorization: Bearer {AUTH_KEY}
X-JavaScript-User-Agent: Google APIs Explorer
{
"id": "{VIDEO_ID}",
"snippet": {
"title": "title change to test1",
"description": "description change to test"
}
}
Response received:
400 Bad Request
- Hide headers -
cache-control: private, max-age=0
content-encoding: gzip
content-length: 134
content-type: application/json; charset=UTF-8
date: Sun, 26 Jan 2014 18:48:13 GMT
expires: Sun, 26 Jan 2014 18:48:13 GMT
server: GSE
{
"error": {
"errors": [
{
"domain": "youtube.video",
"reason": "invalidRequest",
"message": "Bad Request"
}
],
"code": 400,
"message": "Bad Request"
}
}
Seems like snippet.categoryId property is required and it is not documented that you must specify it. Adding this property to a request body solved the problem.
I'm working with the D2L API,and am having difficulty with some POST requests.
Doing a version check (POST) using the JSON object:
[{ "ProductCode": "lp", "Version": "1.0" }]
returns correctly, providing me a valid JSON object in response, that being said I'm confident that my code to issue the call is working correctly.
When I issue a POST to create a post in a forum, however, I get a 404 in response. The JSON object I'm sending for this call is:
[
{
"ParentPostId": null,
"Subject": "API Posted",
"Message": {
"Text": "This message has been posted by the API",
"HTML": "This message has been posted by the API"
},
"IsAnonymous": false
}
]
And the URL submitted to is /d2l/api/le/{ver}/{orgId}/discussions/forums/{forumId}/topics/{topicId}/posts/
I've verified that ver/orgId/forumId/topicId are all valid using a GET of a post in the same forum and topic. I've also tried quoting the values for ParentPostId and IsAnonymous both separately and in unison.
Try removing the square brackets from the JSON.
An example of a successful request and response follows:
REQUEST
POST https://valence.desire2learn.com/d2l/api/le/1.0/7664/discussions/forums/203/topics/508/posts/?x_b=TwULqrltMXvTE8utuLCN5O&x_a=L2Hd9WvDTcyiyu5n2AEgpg&x_d=nF61tBeuzd0EPTW7nm8iGc4MB7NeJZaNM2VlzHp0bwU&x_c=I3i_k2aANTIf2X6aFsiOdvlElSR_avvOYnA2ibcWabA&x_t=1343335429 HTTP/1.1
Accept-Encoding: gzip,deflate
Accept: application/json
Content-Type: application/json
{ "ParentPostId": null, "Subject": "API Posted", "Message": { "Content": "This message has been posted by the API", "Type": "HTML" }, "IsAnonymous": false }
RESPONSE
HTTP/1.1 200 OK
Cache-Control: no-cache, no-store
Pragma: no-cache
Content-Length: 369
Content-Type: application/json; charset=UTF-8
Expires: -1
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET
X-AspNet-Version: 2.0.50727
Date: Thu, 26 Jul 2012 20:43:58 GMT
{"ForumId":203,"PostId":574,"TopicId":508,"PostingUserId":3667,"ThreadId":205,"ParentPostId":null,"Message":{"Text":"","Html":"This message has been posted by the API"},"Subject":"API Posted","DatePosted":"2012-07-26T20:43:58.920Z","IsAnonymous":false,"RequiresApproval":false,"IsDeleted":false,"LastEditDate":null,"LastEditedBy":null,"CanRate":false,"ReplyPostIds":[]}
Looking at the documentation for that route at http://docs.valence.desire2learn.com/res/discuss.html#post--d2l-api-le-(D2LVERSION-version)-(D2LID-orgUnitId)-discussions-forums-(D2LID-forumId)-topics-(D2LID-topicId)-posts-, it looks like the required data structure uses a RichTextInput not a RichText for Message.
Try changing your Message field to:
{
"Content": "This message has been posted by the API",
"Type": "Text"
}