alfresco-js-api
Version:
JavaScript client library for the Alfresco REST API
1,498 lines (1,404 loc) • 204 kB
YAML
swagger: '2.0'
info:
description: |
**Core API**
Provides access to the core features of Alfresco Content Services.
version: '1'
title: Alfresco Content Services REST API
basePath: /alfresco/api/-default-/public/alfresco/versions/1
securityDefinitions:
basicAuth:
type: basic
description: HTTP Basic Authentication
security:
- basicAuth: []
consumes:
- application/json
produces:
- application/json
tags:
- name: activities
description: Retrieve and manage activities
- name: comments
description: Retrieve and manage comments
- name: favorites
description: Retrieve and manage favorites
- name: networks
description: Retrieve and manage networks
- name: nodes
description: Retrieve and manage nodes
- name: people
description: Retrieve and manage people
- name: preferences
description: Retrieve and manage preferences
- name: queries
description: Find nodes, sites, and people using a simple search term
- name: ratings
description: Retrieve and manage ratings
- name: renditions
description: Retrieve and manage file renditions
- name: shared-links
description: Retrieve and manage public shared links
- name: sites
description: Retrieve and manage sites
- name: tags
description: Retrieve and manage tags
- name: trashcan
description: Retrieve and manage deleted nodes
- name: versions
description: Retrieve and manage versions
parameters:
nodeIdParam:
name: nodeId
in: path
description: The identifier of a node.
required: true
type: string
nodeIdWithAliasParam:
name: nodeId
in: path
description: |
The identifier of a node. You can also use one of these well-known aliases:
* -my-
* -shared-
* -root-
required: true
type: string
nodeParentIdParam:
name: nodeId
in: path
description: The identifier of a parent node.
required: true
type: string
nodeParentIdWithAliasParam:
name: nodeId
in: path
description: |
The identifier of a parent node. You can also use one of these well-known aliases:
* -my-
* -shared-
* -root-
required: true
type: string
nodeChildIdWithAliasParam:
name: nodeId
in: path
description: |
The identifier of a child node. You can also use one of these well-known aliases:
* -my-
* -shared-
* -root-
required: true
type: string
nodeSourceIdParam:
name: nodeId
in: path
description: The identifier of a source node.
required: true
type: string
nodeTargetIdParam:
name: nodeId
in: path
description: The identifier of a target node.
required: true
type: string
nodeMinimalEntryIncludeParam:
name: include
in: query
description: |
Returns additional information about the node. The following optional fields can be requested:
* allowableOperations
* aspectNames
* association
* isLink
* isLocked
* path
* properties
* permissions
required: false
type: array
items:
type: string
collectionFormat: csv
nodeAssocMinimalEntryIncludeParam:
name: include
in: query
description: |
Returns additional information about the node. The following optional fields can be requested:
* allowableOperations
* aspectNames
* isLink
* isLocked
* path
* properties
required: false
type: array
items:
type: string
collectionFormat: csv
nodeEntryIncludeParam:
name: include
in: query
description: |
Returns additional information about the node. The following optional fields can be requested:
* allowableOperations
* association
* isLink
* isLocked
* path
* permissions
required: false
type: array
items:
type: string
collectionFormat: csv
personMinimalEntryIncludeParam:
name: include
in: query
description: |
Returns additional information about the person. The following optional fields can be requested:
* properties
* aspectNames
required: false
type: array
items:
type: string
collectionFormat: csv
sharedIdParam:
name: sharedId
in: path
description: The identifier of a shared link to a file.
required: true
type: string
sharedLinkEntryIncludeParam:
name: include
in: query
description: |
Returns additional information about the shared link, the following optional fields can be requested:
* allowableOperations
required: false
type: array
items:
type: string
collectionFormat: csv
renditionIdParam:
name: renditionId
in: path
description: The name of a thumbnail rendition, for example *doclib*, or *pdf*.
required: true
type: string
versionIdParam:
name: versionId
in: path
description: The identifier of a version, ie. version label, within the version history of a node.
required: true
type: string
versionMinimalEntryIncludeParam:
name: include
in: query
description: |
Returns additional information about the version node. The following optional fields can be requested:
* properties
* aspectNames
required: false
type: array
items:
type: string
collectionFormat: csv
personIdParam:
name: personId
in: path
description: The identifier of a person.
required: true
type: string
siteIdParam:
name: siteId
in: path
description: The identifier of a site.
required: true
type: string
tagIdParam:
name: tagId
in: path
description: The identifier of a tag.
required: true
type: string
networkIdParam:
name: networkId
in: path
description: The identifier of a network.
required: true
type: string
commentIdParam:
name: commentId
in: path
description: The identifier of a comment.
required: true
type: string
ratingIdParam:
name: ratingId
in: path
description: The identifier of a rating.
required: true
type: string
favoriteIdParam:
name: favoriteId
in: path
description: The identifier of a favorite.
required: true
type: string
skipCountParam:
name: skipCount
in: query
description: The number of entities that exist in the collection before those included in this list.
required: false
type: integer
minimum: 0
maxItemsParam:
name: maxItems
in: query
description: The maximum number of items to return in the list.
required: false
type: integer
minimum: 1
fieldsParam:
name: fields
in: query
description: |
A list of field names.
You can use this parameter to restrict the fields
returned within a response if, for example, you want to save on overall bandwidth.
The list applies to a returned individual
entity or entries within a collection.
If the API method also supports the **include**
parameter, then the fields specified in the **include**
parameter are returned in addition to those specified in the **fields** parameter.
required: false
type: array
items:
type: string
collectionFormat: csv
orderByParam:
name: orderBy
in: query
description: |
A string to control the order of the entities returned in a list. You can use the **orderBy** parameter to
sort the list by one or more fields.
Each field has a default sort order, which is normally ascending order. Read the API method implementation notes
above to check if any fields used in this method have a descending default search order.
To sort the entities in a specific order, you can use the **ASC** and **DESC** keywords for any field.
required: false
type: array
items:
type: string
collectionFormat: csv
whereParam:
name: where
in: query
description: A string to restrict the returned objects by using a predicate.
required: false
type: string
includeSourceParam:
name: includeSource
in: query
description: Also include **source** (in addition to **entries**) with folder information on **nodeId**
required: false
type: boolean
relationsParam:
name: relations
in: query
description: Use the relations parameter to include one or more related entities in a single response.
required: false
type: array
items:
type: string
collectionFormat: csv
attachmentParam:
name: attachment
in: query
description: |
**true** enables a web browser to download the file as an attachment.
**false** means a web browser may preview the file in a new tab or window, but not
download the file.
You can only set this parameter to **false** if the content type of the file is in the supported list;
for example, certain image files and PDF files.
If the content type is not supported for preview, then a value of **false** is ignored, and
the attachment will be returned in the response.
required: false
default: true
type: boolean
ifModifiedSinceHeader:
name: If-Modified-Since
in: header
description: |
Only returns the content if it has been modified since the date provided.
Use the date format defined by HTTP. For example, `Wed, 09 Mar 2016 16:56:34 GMT`.
required: false
type: string
format: date-time
paths:
'/nodes/{nodeId}/comments':
get:
tags:
- comments
summary: List comments
description: Gets a list of comments for the node **nodeId**, sorted chronologically with the newest comment first.
operationId: listComments
produces:
- application/json
parameters:
- $ref: '#/parameters/nodeIdParam'
- $ref: '#/parameters/skipCountParam'
- $ref: '#/parameters/maxItemsParam'
- $ref: '#/parameters/fieldsParam'
responses:
'200':
description: Successful response
schema:
$ref: '#/definitions/CommentPaging'
'400':
description: |
Invalid parameter: **nodeId** exists but does not identify a file or a folder,
or the value of **maxItems** is invalid, or the value of **skipCount** is invalid
'401':
description: Authentication failed
'403':
description: User does not have permission read comments on the node
'404':
description: |
**nodeId** does not exist
default:
description: Unexpected error
schema:
$ref: '#/definitions/Error'
post:
tags:
- comments
summary: Create a comment
description: |
Creates a comment on node **nodeId**. You specify the comment in a JSON body like this:
```JSON
{
"content": "This is a comment"
}
```
**Note:** You can create more than one comment by
specifying a list of comments in the JSON body like this:
```JSON
[
{
"content": "This is a comment"
},
{
"content": "This is another comment"
}
]
```
If you specify a list as input, then a paginated list rather than an entry is returned in the response body. For example:
```JSON
{
"list": {
"pagination": {
"count": 2,
"hasMoreItems": false,
"totalItems": 2,
"skipCount": 0,
"maxItems": 100
},
"entries": [
{
"entry": {
...
}
},
{
"entry": {
...
}
}
]
}
}
```
operationId: createComment
produces:
- application/json
parameters:
- $ref: '#/parameters/nodeIdParam'
- $ref: '#/parameters/fieldsParam'
- in: body
name: commentBodyCreate
description: The comment text. Note that you can also provide a list of comments.
required: true
schema:
$ref: '#/definitions/CommentBody'
responses:
'201':
description: Successful response
schema:
$ref: '#/definitions/CommentEntry'
'400':
description: |
Invalid parameter: **commentBodyCreate** is invalid
'401':
description: Authentication failed
'403':
description: User does not have permission to create a comment
'404':
description: |
**nodeId** does not exist
'405':
description: Cannot comment on a node of this type
default:
description: Unexpected error
schema:
$ref: '#/definitions/Error'
'/nodes/{nodeId}/comments/{commentId}':
put:
tags:
- comments
summary: Update a comment
description: Updates an existing comment **commentId** on node **nodeId**.
operationId: updateComment
produces:
- application/json
parameters:
- $ref: '#/parameters/nodeIdParam'
- $ref: '#/parameters/commentIdParam'
- $ref: '#/parameters/fieldsParam'
- in: body
name: commentBodyUpdate
description: The JSON representing the comment to be updated.
required: true
schema:
$ref: '#/definitions/CommentBody'
responses:
'200':
description: Successful response
schema:
$ref: '#/definitions/CommentEntry'
'400':
description: |
Invalid parameter: **commentBodyUpdate** is invalid
'401':
description: Authentication failed
'403':
description: User does not have permission to update a comment
'404':
description: |
**nodeId** or **commentId** does not exist
default:
description: Unexpected error
schema:
$ref: '#/definitions/Error'
delete:
tags:
- comments
summary: Delete a comment
description: Deletes the comment **commentId** from node **nodeId**.
operationId: deleteComment
produces:
- application/json
parameters:
- $ref: '#/parameters/nodeIdParam'
- $ref: '#/parameters/commentIdParam'
responses:
'204':
description: Successful response
'401':
description: Authentication failed
'403':
description: User does not have permission to delete a comment
'404':
description: |
**nodeId** or **commentId** does not exist
default:
description: Unexpected error
schema:
$ref: '#/definitions/Error'
'/nodes/{nodeId}/ratings':
get:
tags:
- ratings
summary: List ratings
description: Gets a list of ratings for node **nodeId**.
operationId: listRatings
produces:
- application/json
parameters:
- $ref: '#/parameters/nodeIdParam'
- $ref: '#/parameters/skipCountParam'
- $ref: '#/parameters/maxItemsParam'
- $ref: '#/parameters/fieldsParam'
responses:
'200':
description: Successful response
schema:
$ref: '#/definitions/RatingPaging'
'400':
description: |
Invalid parameter: value of **maxItems** or **skipCount** is invalid
'401':
description: Authentication failed
'404':
description: |
**nodeId** does not exist
default:
description: Unexpected error
schema:
$ref: '#/definitions/Error'
post:
tags:
- ratings
summary: Create a rating
description: Create a rating for the node with identifier **nodeId**
operationId: createRating
produces:
- application/json
parameters:
- $ref: '#/parameters/nodeIdParam'
- $ref: '#/parameters/fieldsParam'
- in: body
name: ratingBodyCreate
description: |
For "myRating" the type is specific to the rating scheme, boolean for the likes and an integer for the fiveStar.
For example, to "like" a file the following body would be used:
```JSON
{
"id": "likes",
"myRating": true
}
```
required: true
schema:
$ref: '#/definitions/RatingBody'
responses:
'201':
description: Successful response
schema:
$ref: '#/definitions/RatingEntry'
'400':
description: |
Invalid parameter: **ratingBodyCreate** is invalid
'401':
description: Authentication failed
'404':
description: |
**nodeId** does not exist
'405':
description: Cannot rate a node of this type
default:
description: Unexpected error
schema:
$ref: '#/definitions/Error'
'/nodes/{nodeId}/ratings/{ratingId}':
get:
tags:
- ratings
summary: Get a rating
description: Get the specific rating **ratingId** on node **nodeId**.
produces:
- application/json
operationId: getRating
parameters:
- $ref: '#/parameters/nodeIdParam'
- $ref: '#/parameters/ratingIdParam'
- $ref: '#/parameters/fieldsParam'
responses:
'200':
description: Successful response
schema:
$ref: '#/definitions/RatingEntry'
'400':
description: |
Invalid parameter: unknown rating scheme specified
'401':
description: Authentication failed
'404':
description: |
**nodeId** does not exist
default:
description: Unexpected error
schema:
$ref: '#/definitions/Error'
delete:
tags:
- ratings
summary: Delete a rating
description: Deletes rating **ratingId** from node **nodeId**.
operationId: deleteRating
produces:
- application/json
parameters:
- $ref: '#/parameters/nodeIdParam'
- $ref: '#/parameters/ratingIdParam'
responses:
'204':
description: Successful response
'400':
description: |
Invalid parameter: unknown rating scheme specified
'401':
description: Authentication failed
'404':
description: |
**nodeId** does not exist
default:
description: Unexpected error
schema:
$ref: '#/definitions/Error'
'/nodes/{nodeId}/tags':
get:
tags:
- tags
summary: List tags for a node
description: Gets a list of tags for node **nodeId**.
operationId: listTagsForNode
produces:
- application/json
parameters:
- $ref: '#/parameters/nodeIdParam'
- $ref: '#/parameters/skipCountParam'
- $ref: '#/parameters/maxItemsParam'
- $ref: '#/parameters/fieldsParam'
responses:
'200':
description: Successful response
schema:
$ref: '#/definitions/TagPaging'
'400':
description: |
Invalid parameter: value of **maxItems** or **skipCount** is invalid
'401':
description: Authentication failed
'403':
description: User does not have permission to read tags on the node
'404':
description: |
**nodeId** does not exist
default:
description: Unexpected error
schema:
$ref: '#/definitions/Error'
post:
tags:
- tags
summary: Create a tag for a node
description: |
Creates a tag on the node **nodeId**. You specify the tag in a JSON body like this:
```JSON
{
"tag":"test-tag-1"
}
```
**Note:** You can create more than one tag by
specifying a list of tags in the JSON body like this:
```JSON
[
{
"tag":"test-tag-1"
},
{
"tag":"test-tag-2"
}
]
```
If you specify a list as input, then a paginated list rather than an entry is returned in the response body. For example:
```JSON
{
"list": {
"pagination": {
"count": 2,
"hasMoreItems": false,
"totalItems": 2,
"skipCount": 0,
"maxItems": 100
},
"entries": [
{
"entry": {
...
}
},
{
"entry": {
...
}
}
]
}
}
```
operationId: createTagForNode
produces:
- application/json
parameters:
- $ref: '#/parameters/nodeIdParam'
- $ref: '#/parameters/fieldsParam'
- in: body
name: tagBodyCreate
description: The new tag
required: true
schema:
$ref: '#/definitions/TagBody'
responses:
'201':
description: Successful response
schema:
$ref: '#/definitions/TagEntry'
'400':
description: |
Invalid parameter: **tagBodyCreate** is invalid
'401':
description: Authentication failed
'403':
description: User does not have permission to create tags on the node
'404':
description: |
**nodeId** does not exist
'405':
description: Cannot tag a node of this type
default:
description: Unexpected error
schema:
$ref: '#/definitions/Error'
'/nodes/{nodeId}/tags/{tagId}':
delete:
tags:
- tags
summary: Delete a tag from a node
description: Deletes tag **tagId** from node **nodeId**.
operationId: deleteTagFromNode
produces:
- application/json
parameters:
- $ref: '#/parameters/nodeIdParam'
- $ref: '#/parameters/tagIdParam'
responses:
'204':
description: Successful response
'401':
description: Authentication failed
'403':
description: User does not have permission to delete the tag
'404':
description: |
**nodeId** or **tagId** does not exist
default:
description: Unexpected error
schema:
$ref: '#/definitions/Error'
'/nodes/{nodeId}':
get:
x-alfresco-since: "5.2"
tags:
- nodes
summary: Get a node
description: |
**Note:** this endpoint is available in Alfresco 5.2 and newer versions.
Get information for node **nodeId**.
You can use the **include** parameter to return additional information.
operationId: getNode
parameters:
- $ref: '#/parameters/nodeIdWithAliasParam'
- $ref: '#/parameters/nodeEntryIncludeParam'
- name: relativePath
in: query
description: |
A path relative to the **nodeId**. If you set this,
information is returned on the node resolved by this path.
required: false
type: string
- $ref: '#/parameters/fieldsParam'
produces:
- application/json
responses:
'200':
description: Successful response
schema:
$ref: '#/definitions/NodeEntry'
'400':
description: |
Invalid parameter: **nodeId** is not a valid format
'401':
description: Authentication failed
'403':
description: Current user does not have permission to retrieve **nodeId**
'404':
description: |
**nodeId** does not exist
default:
description: Unexpected error
schema:
$ref: '#/definitions/Error'
put:
x-alfresco-since: "5.2"
tags:
- nodes
summary: Update a node
description: |
**Note:** this endpoint is available in Alfresco 5.2 and newer versions.
Updates the node **nodeId**. For example, you can rename a file or folder:
```JSON
{
"name":"My new name"
}
```
You can also set or update one or more properties:
```JSON
{
"properties":
{
"cm:title":"Folder title"
}
}
```
**Note:** setting properties of type d:content and d:category are not supported.
**Note:** if you want to add or remove aspects, then you must use **GET /nodes/{nodeId}** first to get the complete set of *aspectNames*.
You can add (or remove) *locallySet* permissions, if any, in addition to any inherited permissions.
You can also optionally disable (or re-enable) inherited permissions via *isInheritanceEnabled* flag:
```JSON
{
"permissions":
{
"isInheritanceEnabled": false,
"locallySet":
[
{"authorityId": "GROUP_special", "name": "Read", "accessStatus":"DENIED"},
{"authorityId": "testuser", "name": "Contributor", "accessStatus":"ALLOWED"}
]
}
}
```
**Note:** if you want to add or remove locally set permissions then you must use **GET /nodes/{nodeId}** first to get the complete set of *locallySet* permissions.
**Note:** Currently there is no optimistic locking for updates, so they are applied in "last one wins" order.
operationId: updateNode
parameters:
- $ref: '#/parameters/nodeIdParam'
- $ref: '#/parameters/nodeEntryIncludeParam'
- $ref: '#/parameters/fieldsParam'
- in: body
name: nodeBodyUpdate
description: The node information to update.
required: true
schema:
$ref: '#/definitions/NodeBodyUpdate'
produces:
- application/json
responses:
'200':
description: Successful response
schema:
$ref: '#/definitions/NodeEntry'
'400':
description: |
Invalid parameter: the update request is invalid or **nodeId** is not a valid format or **nodeBodyUpdate** is invalid
'401':
description: Authentication failed
'403':
description: Current user does not have permission to update **nodeId**
'404':
description: |
**nodeId** does not exist
'409':
description: Updated name clashes with an existing node in the current parent folder
'422':
description: Model integrity exception including a file name containing invalid characters
default:
description: Unexpected error
schema:
$ref: '#/definitions/Error'
delete:
x-alfresco-since: "5.2"
tags:
- nodes
summary: Delete a node
description: |
**Note:** this endpoint is available in Alfresco 5.2 and newer versions.
Deletes the node **nodeId**.
If **nodeId** is a folder, then its children are also deleted.
Deleted nodes move to the trashcan unless the **permanent** query parameter is **true** and the current user is the owner of the node or an admin.
Deleting a node deletes it from its primary parent and also from any secondary parents. Peer associations are also deleted, where the deleted
node is either a source or target of an association. This applies recursively to any hierarchy of primary children of the deleted node.
**Note:** If the node is not permanently deleted, and is later successfully restored to its former primary parent, then the primary
child association is restored. This applies recursively for any primary children. No other secondary child associations or
peer associations are restored for any of the nodes in the primary parent-child hierarchy of restored nodes, regardless of whether the original
associations were to nodes inside or outside the restored hierarchy.
operationId: deleteNode
parameters:
- $ref: '#/parameters/nodeIdParam'
- name: permanent
in: query
description: |
If **true** then the node is deleted permanently, without moving to the trashcan.
Only the owner of the node or an admin can permanently delete the node.
required: false
type: boolean
default: false
produces:
- application/json
responses:
'204':
description: Successful response
'400':
description: |
Invalid parameter: **nodeId** is not a valid format
'401':
description: Authentication failed
'403':
description: Current user does not have permission to delete **nodeId**
'404':
description: |
**nodeId** does not exist
'409':
description: |
**nodeId** is locked and cannot be deleted
default:
description: Unexpected error
schema:
$ref: '#/definitions/Error'
'/nodes/{nodeId}/children':
get:
x-alfresco-since: "5.2"
tags:
- nodes
summary: List node children
description: |
**Note:** this endpoint is available in Alfresco 5.2 and newer versions.
Gets a list of children of the parent node **nodeId**.
Minimal information for each child is returned by default.
You can use the **include** parameter to return additional information.
The list of child nodes includes primary children and secondary children, if there are any.
You can use the **include** parameter (include=association) to return child association details
for each child, including the **assocTyp**e and the **isPrimary** flag.
The default sort order for the returned list is for folders to be sorted before files, and by ascending name
You can override the default using **orderBy** to specify one or more fields to sort by. The default order is always ascending, but
you can use an optional *ASC** or **DESC** modifier to specify an ascending or descending sort order.
For example, specifying ```orderBy=name DESC``` returns a mixed folder/file list in descending **name** order.
You can use any of the following fields to order the results:
* isFolder
* name
* mimeType
* nodeType
* sizeInBytes
* modifiedAt
* createdAt
* modifiedByUser
* createdByUser
operationId: listNodeChildren
parameters:
- $ref: '#/parameters/nodeIdWithAliasParam'
- $ref: '#/parameters/skipCountParam'
- $ref: '#/parameters/maxItemsParam'
- $ref: '#/parameters/orderByParam'
- name: where
in: query
description: |
Optionally filter the list. Here are some examples:
* ```where=(isFolder=true)```
* ```where=(isFile=true)```
* ```where=(nodeType='my:specialNodeType')```
* ```where=(nodeType='my:specialNodeType' INCLUDESUBTYPES)```
* ```where=(isPrimary=true)```
* ```where=(assocType='my:specialAssocType')```
* ```where=(isPrimary=false and assocType='my:specialAssocType')```
required: false
type: string
- $ref: '#/parameters/nodeMinimalEntryIncludeParam'
- name: relativePath
in: query
description: Return information on children in the folder resolved by this path. The path is relative to **nodeId**.
required: false
type: string
- name: includeSource
in: query
description: Also include **source** in addition to **entries** with folder information on the parent node – either the specified parent **nodeId**, or as resolved by **relativePath**.
required: false
type: boolean
- $ref: '#/parameters/fieldsParam'
produces:
- application/json
responses:
'200':
description: Successful response
schema:
$ref: '#/definitions/NodeChildAssociationPaging'
'400':
description: |
Invalid parameter: **nodeId** is not a valid format, **nodeId** is not a folder or **orderBy** is invalid
'401':
description: Authentication failed
'403':
description: Current user does not have permission to retrieve children of **nodeId**
'404':
description: |
**nodeId** does not exist
default:
description: Unexpected error
schema:
$ref: '#/definitions/Error'
post:
x-alfresco-since: "5.2"
tags:
- nodes
summary: Create a node
description: |
**Note:** this endpoint is available in Alfresco 5.2 and newer versions.
Create a node and add it as a primary child of node **nodeId**.
This endpoint supports both JSON and multipart/form-data (file upload).
**Using multipart/form-data**
Use the **filedata** field to represent the content to upload, for example, the following curl command will
create a node with the contents of test.txt in the test user's home folder.
```curl -utest:test -X POST host:port/alfresco/api/-default-/public/alfresco/versions/1/nodes/-my-/children -F filedata=@test.txt```
You can use the **name** field to give an alternative name for the new file.
You can use the **nodeType** field to create a specific type. The default is cm:content.
You can use the **renditions** field to create renditions (e.g. doclib) asynchronously upon upload.
Note that currently only one rendition can be requested. Also, as requesting rendition is a background process,
any rendition failure (e.g. No transformer is currently available) will not fail the whole upload and has the potential to silently fail.
Use **overwrite** to overwrite an existing file, matched by name. If the file is versionable,
the existing content is replaced.
When you overwrite existing content, you can set the **majorVersion** boolean field to **true** to indicate a major version
should be created. The default for **majorVersion** is **false**.
Setting **majorVersion** enables versioning of the node, if it is not already versioned.
When you overwrite existing content, you can use the **comment** field to add a version comment that appears in the
version history. This also enables versioning of this node, if it is not already versioned.
You can set the **autoRename** boolean field to automatically resolve name clashes. If there is a name clash, then
the API method tries to create a unique name using an integer suffix.
You can use the **relativePath** field to specify the folder structure to create relative to the node **nodeId**.
Folders in the **relativePath** that do not exist are created before the node is created.
Any other field provided will be treated as a property to set on the newly created node.
**Note:** setting properties of type d:content and d:category are not supported.
**Using JSON**
You must specify at least a **name** and **nodeType**. For example, to create a folder:
```JSON
{
"name":"My Folder",
"nodeType":"cm:folder"
}
```
You can create an empty file like this:
```JSON
{
"name":"My text file.txt",
"nodeType":"cm:content"
}
```
You can update binary content using the ```PUT /nodes/{nodeId}``` API method.
You can create a folder, or other node, inside a folder hierarchy:
```JSON
{
"name":"My Special Folder",
"nodeType":"cm:folder",
"relativePath":"X/Y/Z"
}
```
The **relativePath** specifies the folder structure to create relative to the node **nodeId**. Folders in the
**relativePath** that do not exist are created before the node is created.
You can set properties when you create a new node:
```JSON
{
"name":"My Other Folder",
"nodeType":"cm:folder",
"properties":
{
"cm:title":"Folder title",
"cm:description":"This is an important folder"
}
}
```
Any missing aspects are applied automatically. For example, **cm:titled** in the JSON shown above. You can set aspects
explicitly, if needed, using an **aspectNames** field.
**Note:** setting properties of type d:content and d:category are not supported.
Typically, for files and folders, the primary children are created within the parent folder using the default "cm:contains" assocType.
If the content model allows then it is also possible to create primary children with a different assoc type. For example:
```JSON
{
"name":"My Node",
"nodeType":"my:specialNodeType",
"association":
{
"assocType":"my:specialAssocType"
}
}
```
Additional associations can be added after creating a node. You can also add associations at the time the node is created. This is
required, for example, if the content model specifies that a node has mandatory associations to one or more existing nodes. You can optionally
specify an array of **secondaryChildren** to create one or more secondary child associations, such that the newly created node acts as a parent node.
You can optionally specify an array of **targets** to create one or more peer associations such that the newly created node acts as a source node.
For example, to associate one or more secondary children at time of creation:
```JSON
{
"name":"My Folder",
"nodeType":"cm:folder",
"secondaryChildren":
[ {"childId":"abcde-01234-...", "assocType":"my:specialChildAssocType"} ]
}
```
For example, to associate one or more targets at time of creation:
```JSON
{
"name":"My Folder",
"nodeType":"cm:folder",
"targets":
[ {"targetId":"abcde-01234-...", "assocType":"my:specialPeerAssocType"} ]
}
```
**Note:** You can create more than one child by
specifying a list of nodes in the JSON body. For example, the following JSON
body creates two folders inside the specified **nodeId**, if the **nodeId** identifies
a folder:
```JSON
[
{
"name":"My Folder 1",
"nodeType":"cm:folder"
},
{
"name":"My Folder 2",
"nodeType":"cm:folder"
}
]
```
If you specify a list as input, then a paginated list rather than an entry is returned in the response body. For example:
```JSON
{
"list": {
"pagination": {
"count": 2,
"hasMoreItems": false,
"totalItems": 2,
"skipCount": 0,
"maxItems": 100
},
"entries": [
{
"entry": {
...
}
},
{
"entry": {
...
}
}
]
}
}
```
operationId: createNode
parameters:
- $ref: '#/parameters/nodeIdWithAliasParam'
- name: autoRename
in: query
description: If true, then a name clash will cause an attempt to auto rename by finding a unique name using an integer suffix.
required: false
type: boolean
- $ref: '#/parameters/nodeEntryIncludeParam'
- $ref: '#/parameters/fieldsParam'
- in: body
name: nodeBodyCreate
description: The node information to create.
required: true
schema:
$ref: '#/definitions/NodeBodyCreate'
consumes:
- application/json
- multipart/form-data
produces:
- application/json
responses:
'201':
description: Successful response
schema:
$ref: '#/definitions/NodeEntry'
'400':
description: |
Invalid parameter: **nodeId** is not a valid format or **nodeBodyCreate** is invalid
'401':
description: Authentication failed
'403':
description: Current user does not have permission to create children of **nodeId**
'404':
description: |
**nodeId** does not exist
'409':
description: New name clashes with an existing node in the current parent folder
'413':
description: Content exceeds individual file size limit configured for the network or system
'422':
description: Model integrity exception including a file name containing invalid characters
'507':
description: Content exceeds overall storage quota limit configured for the network or system
default:
description: Unexpected error
schema:
$ref: '#/definitions/Error'
'/nodes/{nodeId}/copy':
post:
x-alfresco-since: "5.2"
tags:
- nodes
summary: Copy a node
description: |
**Note:** this endpoint is available in Alfresco 5.2 and newer versions.
Copies the node **nodeId** to the parent folder node **targetParentId**. You specify the **targetParentId** in the request body.
The new node has the same name as the source node unless you specify a new **name** in the request body.
If the source **nodeId** is a folder, then all of its children are also copied.
If the source **nodeId** is a file, it's properties, aspects and tags are copied, it's ratings, comments and locks are not.
operationId: copyNode
parameters:
- $ref: '#/parameters/nodeIdParam'
- $ref: '#/parameters/nodeEntryIncludeParam'
- $ref: '#/parameters/fieldsParam'
- in: body
name: nodeBodyCopy
description: The targetParentId and, optionally, a new name which should include the file extension.
required: true
schema:
$ref: '#/definitions/NodeBodyCopy'
consumes:
- application/json
produces:
- application/json
responses:
'201':
description: Successful response
schema:
$ref: '#/definitions/NodeEntry'
'400':
description: |
Invalid parameter: **nodeId** is not a valid format or **nodeBodyCopy** is invalid
'401':
description: Authentication failed
'403':
description: Current user does not have permission to copy **nodeId**
'404':
description: |
**nodeId** does not exist
'409':
description: New name clashes with an existing node in the destination parent folder
'422':
description: Model integrity exception including a file name containing invalid characters
default:
description: Unexpected error
schema:
$ref: '#/definitions/Error'
'/nodes/{nodeId}/lock':
post:
x-alfresco-since: "5.2"
tags:
- nodes
summary: Lock a node
description: |
**Note:** this endpoint is available in Alfresco 5.2 and newer versions.
Places a lock on node **nodeId**.
**Note:** you can only lock files. More specifically, a node can only be locked if it is
of type `cm:content` or a subtype of `cm:content`.
The lock is owned by the current user, and prevents other users or processes from making updates to the node until the lock is released.
If the **timeToExpire** is not set or is zero, then the lock never expires. Otherwise, the **timeToExpire** is the number of seconds before the lock expires.
When a lock expires, the lock is released.
If the node is already locked, and the user is the lock owner, then the lock is renewed with the new **timeToExpire**.
By default, a lock is applied that allows the owner to update or delete the node.
You can use **type** to change the lock type to one of the following:
* **ALLOW_OWNER_CHANGES** (default) changes to the node can be made only by the lock owner. This enum is the same value as the deprecated WRITE_LOCK described in `org.alfresco.service.cmr.lock.LockType` in the Alfresco Public Java API. This is the default value.
* **FULL** no changes by any user are allowed. This enum is the same value as the deprecated READ_ONLY_LOCK described in `org.alfresco.service.cmr.lock.LockType` in the Alfresco Public Java API.
By default, a lock is persisted in the database. You can create a volatile in-memory lock by setting the **lifetime** property to EPHEMERAL.
You might choose use EPHEMERAL locks, for example, if you are taking frequent short-term locks that you don't need
to be kept over a restart of the repository. In this case you don't need the
overhead of writing the locks to the database.
If a lock on the node cannot be taken, then an error is returned.
operationId: lockNode
parameters:
- $ref: '#/parameters/nodeIdParam'
- $ref: '#/parameters/nodeEntryIncludeParam'
- $ref: '#/parameters/fieldsParam'
- in: body
name: nodeBodyLock
description: Lock details.
required: true
schema:
$ref: '#/definitions/NodeBodyLock'
consumes:
- application/json
produces:
- application/json
responses:
'200':
description: Successful response
schema:
$ref: '#/definitions/NodeEntry'
'400':
description: |
Invalid parameter: **nodeId** is not a valid format, or **nodeBodyLock** is invalid,
or a lock was attempted on a node that is not a file
'401':
description: Authentication failed
'403':
description: |
Current user does not have permission to lock **nodeId**
'404':
description: |
**nodeId** does not exist
'422':
description: |
**nodeId** could not be locked
default:
description: Unexpected error
schema:
$ref: '#/definitions/Error'
'/nodes/{nodeId}/unlock':
post:
x-alfresco-since: "5.2"
tags:
- nodes
summary: Unlock a node
description: |
**Note:** this endpoint is available in Alfresco 5.2 and newer versions.
Deletes a lock on node **nodeId**.
The current user must be the owner of the locks or have admin rights, otherwise an error is returned.
If a lock on the node cannot be released, then an error is returned.
operationId: unlockNode
parameters:
- $ref: '#/parameters/nodeIdParam'
- $ref: '#/parameters/nodeEntryIncludeParam'
- $ref: '#/parameters/fieldsParam'
consumes:
- application/json
produces:
- application/json
responses:
'200':
description: Successful response
schema:
$ref: '#/definitions/NodeEntry'
'400':
description: |
Invalid parameter: **nodeId** is not a valid format
'401':
description: Authentication failed
'403':
description: |
Current user does not have permission to unlock **nodeId**
'404':
description: |
**nodeId** does not exist
'422':
description: |
**nodeId** could not be unlocked
default:
description: Unexpected error
schema:
$ref: '#/definitions/Error'
'/nodes/{nodeId}/move':
post:
x-alfresco-since: "5.2"
tags:
- nodes
summary: Move a node
description: |
**Note:** this endpoint is available in Alfresco 5.2 and newer versions.
Move the node **nodeId** to the parent folder node **targetParentId**.
The **targetParentId** is specified in the in request body.
The moved node retains its name unless you specify a new **name** in the request body.
If the source **nodeId** is a folder, then its children are also moved.
The