Documents

The Documents service is used for managing Umbraco Documents. All requests to the Documents service must be authenticated with a user account with permissions to modify the Umbraco Content section.

GET /rest/documents?doctypealias={doctypealias}

Get's the root list of documents, filtered by the optional Doc Type Alias.

Response
Returns a '200 OK' status code.

Content Type: application/json

[
    {
        "Id" : 1234,
        "Name" : "Document Name",
        "DocTypeAlias" : "Doc Type Alias",
        ...
    },
    {
        "Id" : 1235,
        "Name" : "Document Name",
        "DocTypeAlias" : "Doc Type Alias",
        ...
    }
]

GET /rest/documents/{id}

Gets a single document identified by its integer ID.

Response
Returns a '200 OK' status code.

Content Type: application/json

{
    "Id" : 1234,
    "Name" : "Document Name",
    "DocTypeAlias" : "Doc Type Alias",
    ...
}

GET /rest/documents/{id}/documents?doctypealias={doctypealias}

Gets a list of child documents for the document identified by its integer ID, filtered by the optional Doc Type Alias.

Response
Returns a '200 OK' status code.

Content Type: application/json

[
    {
        "Id" : 1234,
        "Name" : "Document Name",
        "DocTypeAlias" : "Doc Type Alias",
        ...
    },
    {
        "Id" : 1235,
        "Name" : "Document Name",
        "DocTypeAlias" : "Doc Type Alias",
        ...
    }
]

POST /rest/documents

Creates a new document.

Request

Content Type: application/json

{
    "Name" : "Document Name",
    "DocTypeAlias" : "Doc Type Alias",
    ...
}
Response
Returns a '201 Created' status code.

Content Type: application/json

{
    "Id" : 1234,
    "Name" : "Document Name",
    "DocTypeAlias" : "Doc Type Alias",
    ...
}

POST /rest/documents/{id}/documents

Creates a new child document for the document identified by its integer ID.

Request

Content Type: application/json

{
    "Name" : "Document Name",
    "DocTypeAlias" : "Doc Type Alias",
    ...
}
Response
Returns a '201 Created' status code.

Content Type: application/json

{
    "Id" : 1234,
    "Name" : "Document Name",
    "DocTypeAlias" : "Doc Type Alias",
    ...
}

PUT /rest/documents/{id}

Updates an existing document identified by its integer ID.

Request

Content Type: application/json

{
    "Name" : "Document Name",
    "DocTypeAlias" : "Doc Type Alias",
    ...
}
Response
Returns a '201 Created' status code.

Content Type: application/json

{
    "Id" : 1234,
    "Name" : "Document Name",
    "DocTypeAlias" : "Doc Type Alias",
    ...
}

DELETE /rest/documents/{id}

Deletes a document identified by its integer ID.

Response
Returns a '204 No Content' status code.

Resources

Document

{
    "Id" : 1234,
    "Href" : "http://www.yoursite.com/rest/documents/1234",
    "ParentId" : 1233,
    "ParentHref" : "http://www.yoursite.com/rest/documents/1233",
    "Name" : "Document Name",
    "DocTypeAlias" : "Doc Type Alias",
    "Properties" : [
        {
            "Key" : "Property Key",
            "Value" : "Property Value"   
        },
        ...
    ],
    "HasChildren" : true,
    "ChildrenHref" : "http://www.yoursite.com/rest/documents/1234/documents",
    "IsPublished" : true,
    "PublishAction" : "Ignore/Publish/UnPublish",
    "ReleaseDate" : "/Date(1234567890000+0000)/",
    "ExpireDate" : "/Date(1234567890000+0000)/"
}

Last edited Dec 20, 2010 at 9:16 AM by mattbrailsford, version 15

Comments

kodejack Oct 9, 2012 at 4:50 PM 
Hi,

I've been testing out uRest.

I'm trying to create a document without publishing it?

When I create a new document (which works fine) I pass the following:

DocTypeAlias = Test;
HasChildren = 0;
IsPublished = 0;------ Also tried "False"
PublishAction = 2; ------ Also tried "UnPublished"
Name = "Upload from App";
Properties = (
{
Key = text;
Value = "Upload from App - 2012-10-09 16:40:29";
},
{
Key = textbox;
Value = "New test post ";
}
);

However it always publishes the document??

The response i get always says:

{
"Id":1078,
"Href":"<myURL]>/rest/documents/1078",
"ParentId":1049,
"ParentHref":"http://<myURL]>/rest/documents/1049",
"Name":"Upload from App (12)",
"DocTypeAlias":"Test",
"Properties":[
{"Key":"text","Value":"Blog Upload from App - 2012-10-09 16:40:29"},
{"Key":"textbox","Value":"New test post "}
],
"HasChildren":false,
"ChildrenHref":"",
"IsPublished":true,
"PublishAction":0,
"ReleaseDate":"\/Date(-62135596800000+0000)\/",
"ExpireDate":"\/Date(-62135596800000+0000)\/"
}


Any help appreciated

Gordon