Copy operation on new OneDrive API

kurotsuki

New member
Sep 3, 2012
27
1
1
Visit site
I've been stumbling on this issue for a while. I'm trying to copy file which is located at OneDrive's folder into another folder within the same account. (i.e: from user's root folder to one of it's subfolder).

According to OneDrive Copy API, I need to call this REST API:
Code:
POST /drive/items/{item-id}/action.copy

where {item-id} is the file's id which I want to copy. For this request, I've using this content:
Code:
{
    "parentReference": {
        "id": [destination-folder-id]
    }
}

This http call was work just fine. I've got the desired result which is:
Code:
HTTP/1.1 202 Accepted
Location: https://onedrive.com/monitor/[generated-alphanumeric-characters]

When I following the link at Location header, I got the async job status which is:
Code:
{
    "operation": "ItemCopy",
    "percentageComplete": 0,
    "status": "notStarted",
    "statusDescription": "Completed 0/0 files; 0/0 bytes"
}

The problem is, no matter how many times I wait and call this link, it gives the exact response, which it's status was notStarted. I also try to reproduce this using OneDrive's API Console and it shows exact behaviors. I don't have any problem when copying an empty folder. This problem only occurs on files. Does anyone know why? Is there anything I should do to start that async job?

Note: I also asking this question at stackoverflow. I'll update this thread when that question is answered.
 

kurotsuki

New member
Sep 3, 2012
27
1
1
Visit site
It seems that no one knows about this problem. For now, I have to use the old OneDrive API (formerly SkyDrive API) only for this copy operation, like this example:
Code:
COPY https://apis.live.net/v5.0/file.a6b2a7e8f2515e5e.A6B2A7E8F2515E5E!126

Authorization: Bearer ACCESS_TOKEN
Content-Type: application/json
{
    "destination": "folder.a6b2a7e8f2515e5e.A6B2A7E8F2515E5E!114"
}
The things after file. and folder. is user id followed by item id (file id for the item or folder id for destination). Note that this only works on file. We cannot copy folder. If success, it will return a status code of Created.

Oh, and ... In order to use this API, we need to have wl.skydrive_update in the scope when authenticating our app.
 

Members online

Forum statistics

Threads
326,636
Messages
2,248,681
Members
428,526
Latest member
Youngbradse