Forum Discussion

manojdwivedi2's avatar
manojdwivedi2
Copper Contributor
May 31, 2024

Getting Error : 400 Bad Request and invalidRequest While creating OneDrive Documents versions Graph

Here going to create versions (version history) of a document using this type of curl

POST /v1.0/drives/{drive-id}/items/{item-id}/versions
Content-Type: application/json


{
    "content": {
        "@odata.type": "#microsoft.graph.fileContent",
        "sourceUrl": "data:text/plain;base64,SGVsbG8gV29ybGQhCg=="
    }
}

but in the response I am getting following error:

{
    "error": {
        "code": "invalidRequest",
        "message": "Invalid request",
        "innerError": {
            "date": "2024-05-29T20:10:45",
            "request-id": "c1899a5f-e6d6-445d-b563-efb03268175c",
            "client-request-id": "c1899a5f-e6d6-445d-b563-efb03268175c"
        }
    }
}

What am I doing wrong? Is there any other Microsoft Graph API or method for creating documents versions.

In the response I expect 'Created' or 201 code, that means a new version of file or document added in version history. Please help me to resolve this error. Thanks in Advance !

 

No RepliesBe the first to reply

Resources