API Docs for: 1.5.0
Show:

ContentService Class

Creates an instance of Content Service object. Use ContentService to retrieve information and execute operations related to Content.

Note on the callbacks usage

The callback argument of the service methods always take 2 arguments:

  • **error** either false or CAPIError object when an error occurred
    
  • **response** the Response object
    

Example:

contentService.loadRoot(function (error, response) {
       if (error) {
           console.log('An error occurred', error);
       } else {
           console.log('Success!', response);
       }
});

Constructor

ContentService

(
  • connectionManager
  • discoveryService
  • rootPath
)

Parameters:

  • connectionManager ConnectionManager

    connection manager that will be used to send requests to REST service

  • discoveryService DiscoveryService

    is handling REST paths auto-discovery

  • rootPath String

    path to Root resource

Example:

var contentService = jsCAPI.getContentService();

Methods

addRelation

(
  • versionedContentId
  • relationCreateStruct
  • callback
)

Creates a new relation of type COMMON for the given draft.

Parameters:

  • versionedContentId String

    target version identifier (e.g. "/api/ezp/v2/content/objects/102/versions/5")

  • relationCreateStruct RelationCreateStruct

    object describing new relation to be created

  • callback Function

    callback executed after performing the request (see Note on the callbacks usage for more info)

Example:

var relationCreateStruct = contentService.newRelationCreateStruct("/api/ezp/v2/content/objects/132");
contentService.addRelation(
    "/api/ezp/v2/content/objects/102/versions/5",
    relationCreateStruct,
    callback
);

copyContent

(
  • contentId
  • destinationId
  • callback
)

Copy content to determined location

Parameters:

  • contentId String

    target content identifier (e.g. "/api/ezp/v2/content/objects/108")

  • destinationId String

    A location resource to which the content object should be copied (e.g. "/api/ezp/v2/content/locations/1/2/119")

  • callback Function

    callback executed after performing the request (see Note on the callbacks usage for more info)

copySubtree

(
  • subtree
  • targetLocation
  • callback
)

Copies the subtree starting from "subtree" as a new subtree of "targetLocation"

Parameters:

  • subtree String

    source subtree location

  • targetLocation String

    location where source subtree should be copied

  • callback Function

    callback executed after performing the request (see Note on the callbacks usage for more info)

createContent

(
  • contentCreateStruct
  • [requestEventHandlers]
  • callback
)

Creates a new content draft assigned to the authenticated user.

Parameters:

  • contentCreateStruct ContentCreateStruct

    object describing content to be created

  • [requestEventHandlers] Object optional

    a set of callbacks to apply on a specific XHR event like onload, onerror, onprogress, etc.

  • callback Function

    callback executed after performing the request (see Note on the callbacks usage for more info)

Example:

 var contentService = jsCAPI.getContentService();

 contentService.createContent(
     {
         body: '',
         headers: {}
     },
     {
         upload: {
             onloadstart: someUploadCallback,
             onload: someUploadCallback,
             onloadend: someUploadCallback,
             onprogress: someUploadCallback,
             onabort: someUploadCallback,
             onerror: someUploadCallback,
             ontimeout: someUploadCallback,
         },
         onloadstart: someCallback,
         onload: someCallback,
         onloadend: someCallback,
         onprogress: someCallback,
         onabort: someCallback,
         onerror: someCallback,
         ontimeout: someCallback,
     },
     callback
 );

createContentDraft

(
  • contentId
  • [versionId]
  • callback
)

Creates a draft from a published or archived version.

Parameters:

  • contentId String

    target content identifier (e.g. "/api/ezp/v2/content/objects/108")

  • [versionId] Number optional

    numerical id of the base version for the new draft. If not provided the current version of the content will be used.

  • callback Function

    callback executed after performing the request (see Note on the callbacks usage for more info)

Example:

 // Create draft from current version
 contentService.createContentDraft(
     "/api/ezp/v2/content/objects/107",
     null,
     callback
 );

 // Create draft from version #2
 contentService.createContentDraft(
     "/api/ezp/v2/content/objects/107",
     2,
     callback
 );

createLocation

(
  • contentId
  • locationCreateStruct
  • callback
)

Creates a new location for target content object

Parameters:

  • contentId String

    target content identifier (e.g. "/api/ezp/v2/content/objects/108")

  • locationCreateStruct LocationCreateStruct

    object describing new location to be created

  • callback Function

    callback executed after performing the request (see Note on the callbacks usage for more info)

createObjectState

(
  • objectStateGroupId
  • objectStateCreateStruct
  • callback
)

Creates a new ObjectState in target group

Parameters:

  • objectStateGroupId String

    target group, where new object state should be created (e.g. "/api/ezp/v2/content/objectstategroups/2")

  • objectStateCreateStruct ObjectStateCreateStruct

    object describing new ObjectState to be created

  • callback Function

    callback executed after performing the request (see Note on the callbacks usage for more info)

createObjectStateGroup

(
  • objectStateGroups
  • objectStateGroupCreateStruct
  • callback
)

Create a new ObjectState group

Parameters:

  • objectStateGroups String

    path to root objectStateGroups (will be replaced by auto-discovered soon)

  • objectStateGroupCreateStruct ObjectStateGroupCreateStruct

    object describing new ObjectState group to be created

  • callback Function

    callback executed after performing the request (see Note on the callbacks usage for more info)

createSection

(
  • sectionInputStruct
  • callback
)

Create a new section

Parameters:

createUrlAlias

(
  • urlAliases
  • urlAliasCreateStruct
  • callback
)

Creates a new UrlAlias

Parameters:

  • urlAliases String

    link to root UrlAliases resource (should be auto-discovered)

  • urlAliasCreateStruct UrlAliasCreateStruct

    object describing new UrlAlias to be created

  • callback Function

    callback executed after performing the request (see Note on the callbacks usage for more info)

createUrlWildcard

(
  • urlWildcards
  • urlWildcardCreateStruct
  • callback
)

Creates a new UrlWildcard

Parameters:

  • urlWildcards String

    link to root UrlWildcards resource (should be auto-discovered)

  • urlWildcardCreateStruct UrlWildcardCreateStruct

    object describing new UrlWildcard to be created

  • callback Function

    callback executed after performing the request (see Note on the callbacks usage for more info)

createView

(
  • viewCreateStruct
  • callback
)

Creates a new view. Views are used to perform content queries by certain criteria.

Parameters:

Example:

var viewCreateStruct = contentService.newViewCreateStruct('some-test-id', 'LocationQuery');
viewCreateStruct.body.ViewInput.LocationQuery.Query = {
    FullTextCriterion : "title"
};
contentService.createView(
    viewCreateStruct,
    callback
);

deleteContent

(
  • contentId
  • callback
)

Delete target content

Parameters:

  • contentId String

    target content identifier (e.g. "/api/ezp/v2/content/objects/108")

  • callback Function

    callback executed after performing the request (see Note on the callbacks usage for more info)

Example:

 contentService.deleteContent(
     "/api/ezp/v2/content/objects/116",
     callback
 );

deleteLocation

(
  • locationId
  • callback
)

Deletes the location and all it's subtrees Every content object is deleted which does not have any other location. Otherwise the deleted location is removed from the content object. The children are recursively deleted.

Parameters:

  • locationId String

    target location identifier (e.g. "/api/ezp/v2/content/locations/1/2/102")

  • callback Function

    callback executed after performing the request (see Note on the callbacks usage for more info)

deleteObjectState

(
  • objectStateId
  • callback
)

Delete target ObjectState

Parameters:

  • objectStateId String

    target object state identifier (e.g. "/api/ezp/v2/content/objectstategroups/7/objectstates/5")

  • callback Function

    callback executed after performing the request (see Note on the callbacks usage for more info)

deleteObjectStateGroup

(
  • objectStateGroupId
  • callback
)

Delete target ObjectState group

Parameters:

  • objectStateGroupId String

    target object state group identifier (e.g. "/api/ezp/v2/content/objectstategroups/2")

  • callback Function

    callback executed after performing the request (see Note on the callbacks usage for more info)

deleteRelation

(
  • relationId
  • callback
)

Delete target relation

Parameters:

  • relationId String

    target relation identifier (e.g. "/api/ezp/v2/content/objects/102/versions/5/relations/1")

  • callback Function

    callback executed after performing the request (see Note on the callbacks usage for more info)

deleteSection

(
  • sectionId
  • callback
)

Delete target section

Parameters:

  • sectionId String

    target section identifier (e.g. "/api/ezp/v2/content/sections/2")

  • callback Function

    callback executed after performing the request (see Note on the callbacks usage for more info)

deleteTrashItem

(
  • trashItemId
  • callback
)

Delete target trashItem

Parameters:

  • trashItemId String

    target trash item identifier (e.g. "/api/ezp/v2/content/trash/1")

  • callback Function

    callback executed after performing the request (see Note on the callbacks usage for more info)

deleteUrlAlias

(
  • urlAliasId
  • callback
)

Delete target URL Alias

Parameters:

  • urlAliasId String

    target url alias identifier (e.g. "/api/ezp/v2/content/urlaliases/0-a903c03b86eb2987889afa5fe17004eb")

  • callback Function

    callback executed after performing the request (see Note on the callbacks usage for more info)

deleteUrlWildcard

(
  • urlWildcardId
  • callback
)

Deletes target UrlWildcard

Parameters:

  • urlWildcardId String

    target url wildcard identifier (e.g. "/api/ezp/v2/content/urlwildcards/1")

  • callback Function

    callback executed after performing the request (see Note on the callbacks usage for more info)

deleteVersion

(
  • versionedContentId
  • callback
)

Deletes target version of the content.

Parameters:

  • versionedContentId String

    target version identifier (e.g. "/api/ezp/v2/content/objects/108/versions/2")

  • callback Function

    callback executed after performing the request (see Note on the callbacks usage for more info)

emptyThrash

(
  • callback
)
deprecated

Defined in src/services/ContentService.js:1467

Deprecated: since 1.1 and will be removed in 2.0. Is replaced `emptyTrash` which has the same behavior

Empty the trash can

Parameters:

emptyTrash

(
  • callback
)

Empty the trash can

Parameters:

getContentState

(
  • contentStatesId
  • callback
)

Get ObjectStates of target content

Parameters:

  • contentStatesId String

    link to target content's object states (should be auto-discovered from contentId)

  • callback Function

    callback executed after performing the request (see Note on the callbacks usage for more info)

listLocationAliases

(
  • locationUrlAliases
  • [custom=true]
  • callback
)

Loads all the UrlAliases for a location

Parameters:

  • locationUrlAliases String

    link to target location's UrlAliases (should be auto-discovered from locationId)

  • [custom=true] Boolean optional

    this flag indicates weather autogenerated (false) or manual url aliases (true) should be returned

  • callback Function

    callback executed after performing the request (see Note on the callbacks usage for more info)

loadContent

(
  • versionedContentId
  • [languages='']
  • [fields='']
  • [responseGroups='']
  • callback
)

Loads a specific version of target content. This method returns fields and relations

Parameters:

  • versionedContentId String

    target version identifier (e.g. "/api/ezp/v2/content/objects/108/versions/2")

  • [languages=''] String optional

    (comma separated list) restricts the output of translatable fields to the given languages.

  • [fields=''] String optional

    comma separated list of fields which should be returned in the response (see Content).

  • [responseGroups=''] String optional

    alternative: comma separated lists of predefined field groups (see REST API Spec v1).

  • callback Function

    callback executed after performing the request (see Note on the callbacks usage for more info)

Example:

contentService.loadContent(
     '/api/ezp/v2/content/objects/180/versions/1',
     'eng-US',
     '',
     '',
     callback
);

loadContentByRemoteId

(
  • remoteId
  • callback
)

Load single content by remoteId

Parameters:

  • remoteId String

    remote id of target content object (e.g. "30847bec12a8a398777493a4bdb10398")

  • callback Function

    callback executed after performing the request (see Note on the callbacks usage for more info)

loadContentInfo

(
  • contentId
  • callback
)

Load single content info

Parameters:

  • contentId String

    target content identifier (e.g. "/api/ezp/v2/content/objects/108")

  • callback Function

    callback executed after performing the request (see Note on the callbacks usage for more info)

loadContentInfoAndCurrentVersion

(
  • contentId
  • [languageCodes=false]
  • callback
)

Load single content info with embedded current version

Parameters:

  • contentId String

    target content identifier (e.g. "/api/ezp/v2/content/objects/108")

  • [languageCodes=false] String optional

    comma separated list of language codes (ie "fre-FR,eng-GB")

  • callback Function

    callback executed after performing the request (see Note on the callbacks usage for more info)

loadCurrentRelations

(
  • contentId
  • [limit=-1]
  • [offset=0]
  • callback
)

Loads the relations of the target content's current version

Parameters:

  • contentId String

    target content identifier (e.g. "/api/ezp/v2/content/objects/102")

  • [limit=-1] Number optional

    the number of results returned

  • [offset=0] Number optional

    the offset of the result set

  • callback Function

    callback executed after performing the request (see Note on the callbacks usage for more info)

Example:

//See loadLocationChildren for example of "offset" and "limit" arguments usage

loadCurrentVersion

(
  • contentId
  • callback
)

Load current version for target content

Parameters:

  • contentId String

    target content identifier (e.g. "/api/ezp/v2/content/objects/108")

  • callback Function

    callback executed after performing the request (see Note on the callbacks usage for more info)

loadImageVariation

(
  • variation
  • callback
)

Loads an image variation

Parameters:

  • variation String

    The variation REST id

  • callback Function

    Callback executed after performing the request (see Note on the callbacks usage for more info)

loadLocation

(
  • locationId
  • callback
)

Loads target location

Parameters:

  • locationId String

    target location identifier (e.g. "/api/ezp/v2/content/locations/1/2/102")

  • callback Function

    callback executed after performing the request (see Note on the callbacks usage for more info)

loadLocationByRemoteId

(
  • remoteId
  • callback
)

Loads target location by remote Id

Parameters:

  • remoteId String

    remote id of target location (e.g. "0bae96bd419e141ff3200ccbf2822e4f")

  • callback Function

    callback executed after performing the request (see Note on the callbacks usage for more info)

loadLocationChildren

(
  • locationId
  • [limit=-1]
  • [offset=0]
  • callback
)

Loads children for the target location

Parameters:

  • locationId String

    target location identifier (e.g. "/api/ezp/v2/content/locations/1/2/102")

  • [limit=-1] Number optional

    the number of results returned

  • [offset=0] Number optional

    the offset of the result set

  • callback Function

    callback executed after performing the request (see Note on the callbacks usage for more info)

Example:

contentService.loadLocationChildren(
    "/api/ezp/v2/content/locations/1/2/102",
    5,
    5,
    callback
);

loadLocations

(
  • contentId
  • callback
)

Loads all locations for target content object

Parameters:

  • contentId String

    target content identifier (e.g. "/api/ezp/v2/content/objects/108")

  • callback Function

    callback executed after performing the request (see Note on the callbacks usage for more info)

loadObjectState

(
  • objectStateId
  • callback
)

Load target ObjectState

Parameters:

  • objectStateId String

    target object state identifier (e.g. "/api/ezp/v2/content/objectstategroups/7/objectstates/5")

  • callback Function

    callback executed after performing the request (see Note on the callbacks usage for more info)

loadObjectStateGroup

(
  • objectStateGroupId
  • callback
)

Loads target ObjectState group

Parameters:

  • objectStateGroupId String

    target object state group identifier (e.g. "/api/ezp/v2/content/objectstategroups/2")

  • callback Function

    callback executed after performing the request (see Note on the callbacks usage for more info)

loadObjectStateGroups

(
  • objectStateGroups
  • callback
)

Loads all the ObjectState groups

Parameters:

  • objectStateGroups String

    path to root objectStateGroups (will be replaced by auto-discovered soon)

  • callback Function

    callback executed after performing the request (see Note on the callbacks usage for more info)

loadRelation

(
  • relationId
  • callback
)

Loads target relation

Parameters:

  • relationId String

    target relation identifier (e.g. "/api/ezp/v2/content/objects/102/versions/5/relations/1")

  • callback Function

    callback executed after performing the request (see Note on the callbacks usage for more info)

loadRelations

(
  • versionedContentId
  • [limit=-1]
  • [offset=0]
  • callback
)

Loads the relations of the target version.

Parameters:

  • versionedContentId String

    target version identifier (e.g. "/api/ezp/v2/content/objects/108/versions/2")

  • [limit=-1] Number optional

    the number of results returned

  • [offset=0] Number optional

    the offset of the result set

  • callback Function

    callback executed after performing the request (see Note on the callbacks usage for more info)

Example:

//See loadLocationChildren for example of "offset" and "limit" arguments usage

loadRoot

(
  • callback
)

List the root resources of the eZ Publish installation. Root resources contain many paths and references to other parts of the REST interface. This call is used by DiscoveryService automatically, whenever needed.

Parameters:

loadSection

(
  • sectionId
  • callback
)

Load single section

Parameters:

  • sectionId String

    target section identifier (e.g. "/api/ezp/v2/content/sections/2")

  • callback Function

    callback executed after performing the request (see Note on the callbacks usage for more info)

loadSections

(
  • callback
)

List all available sections of eZ Publish instance

Parameters:

loadTrashItem

(
  • trashItemId
  • callback
)

Loads target trash can item

Parameters:

  • trashItemId String

    target trash item identifier (e.g. "/api/ezp/v2/content/trash/1")

  • callback Function

    callback executed after performing the request (see Note on the callbacks usage for more info)

loadTrashItems

(
  • [limit=-1]
  • [offset=0]
  • callback
)

Loads all the trash can items

Parameters:

  • [limit=-1] Number optional

    the number of results returned

  • [offset=0] Number optional

    the offset of the result set

  • callback Function

    callback executed after performing the request (see Note on the callbacks usage for more info)

Example:

//See loadLocationChildren for example of "offset" and "limit" arguments usage

loadUrlAlias

(
  • urlAliasId
  • callback
)

Load target URL Alias

Parameters:

  • urlAliasId String

    target url alias identifier (e.g. "/api/ezp/v2/content/urlaliases/0-a903c03b86eb2987889afa5fe17004eb")

  • callback Function

    callback executed after performing the request (see Note on the callbacks usage for more info)

loadUrlAliases

(
  • urlAliases
  • callback
)

Loads all the global UrlAliases

Parameters:

  • urlAliases String

    link to root UrlAliases resource (should be auto-discovered)

  • callback Function

    callback executed after performing the request (see Note on the callbacks usage for more info)

loadUrlWildcard

(
  • urlWildcardId
  • callback
)

Loads target UrlWildcard

Parameters:

  • urlWildcardId String

    target url wildcard identifier (e.g. "/api/ezp/v2/content/urlwildcards/1")

  • callback Function

    callback executed after performing the request (see Note on the callbacks usage for more info)

loadUrlWildcards

(
  • urlWildcards
  • callback
)

Loads all UrlWildcards

Parameters:

  • urlWildcards String

    link to root UrlWildcards resource (should be auto-discovered)

  • callback Function

    callback executed after performing the request (see Note on the callbacks usage for more info)

loadUserDrafts

(
  • userId
  • callback
)

Loads user drafts

Parameters:

  • userId String

    target user identifier (e.g. "/api/ezp/v2/user/users/14")

  • callback Function

    callback executed after performing the request (see Note on the callbacks usage for more info)

loadVersions

(
  • contentId
  • callback
)

Loads all versions for the target content

Parameters:

  • contentId String

    target content identifier (e.g. "/api/ezp/v2/content/objects/108")

  • callback Function

    callback executed after performing the request (see Note on the callbacks usage for more info)

moveSubtree

(
  • subtree
  • targetLocation
  • callback
)

Moves the subtree to a new subtree of "targetLocation" The targetLocation can also be /content/trash, in that case the location is put into the trash.

Parameters:

  • subtree String

    source subtree location

  • targetLocation String

    location where source subtree should be moved

  • callback Function

    callback executed after performing the request (see Note on the callbacks usage for more info)

newContentCreateStruct

(
  • contentTypeId
  • locationCreateStruct
  • language
)
ContentCreateStruct

Returns create structure for Content object

Parameters:

  • contentTypeId String

    Content Type for new Content object (e.g.: /api/v2/ezp/content/type/1)

  • locationCreateStruct LocationCreateStruct

    create structure for a Location object, where the new Content object will be situated

  • language String

    The language code (eng-GB, fre-FR, ...)

newContentMetadataUpdateStruct

()

Returns update structure for Content object metadata

Returns:

ContentMetadataUpdateStruct

newContentUpdateStruct

(
  • language
)
ContentUpdateStruct

Returns update structure for Content object

Parameters:

  • language String

    The language code (eng-GB, fre-FR, ...)

newLocationCreateStruct

(
  • parentLocationId
)
LocationCreateStruct

Returns create structure for Location object

Parameters:

  • parentLocationId String

    Reference to the parent location of the new Location. (e.g. "/api/ezp/v2/content/locations/1/2/118")

newLocationUpdateStruct

() LocationUpdateStruct

Returns update structure for Location object

newObjectStateCreateStruct

(
  • identifier
  • languageCode
  • priority
  • names
  • descriptions
)
ObjectStateCreateStruct

Returns create structure for ObjectState

Parameters:

  • identifier String

    unique ObjectState identifier (e.g. "some-new-state")

  • languageCode String

    The language code (eng-GB, fre-FR, ...)

  • priority Number
  • names Array

    Multi language value (see example)

  • descriptions Array

    Multi language value (see example)

Example:

 var objectStateCreateStruct = contentService.newObjectStateCreateStruct(
     "some-id", "eng-US", 0, [{
         "_languageCode":"eng-US",
         "#text":"Some Name"
     }], [{
         "_languageCode":"eng-US",
         "#text":"Some Description"
     }]
 );

newObjectStateGroupCreateStruct

(
  • identifier
  • languageCode
  • names
)
ObjectStateGroupCreateStruct

Returns create structure for ObjectStateGroup

Parameters:

  • identifier String

    unique ObjectStateGroup identifier (e.g. "some-new-group")

  • languageCode String

    The language code (eng-GB, fre-FR, ...)

  • names Array

    Multi language value (see example)

Example:

 var objectStateGroupCreateStruct = contentService.newObjectStateGroupCreateStruct(
     "some-id", "eng-US", [{
         "_languageCode":"eng-US",
         "#text":"Some Name"
     }]
 );

newObjectStateGroupUpdateStruct

()

Returns update structure for ObjectStateGroup

Returns:

ObjectStateGroupUpdateStruct

newObjectStateUpdateStruct

() ObjectStateUpdateStruct

Returns update structure for ObjectState

newRelationCreateStruct

(
  • destination
)
RelationCreateStruct

Returns create structure for Relation

Parameters:

  • destination String

    reference to the resource we want to make related

newSectionInputStruct

(
  • identifier
  • name
)
SectionInputStruct

Returns input structure for Section object. Input structure is needed while creating and updating the object.

Parameters:

  • identifier String

    unique section identifier (e.g. "media")

  • name String

    section name (e.g. "Media")

Returns:

newUrlAliasCreateStruct

(
  • languageCode
  • resource
  • path
)
UrlAliasCreateStruct

Returns create structure for UrlAlias

Parameters:

  • languageCode String

    The language code (eng-GB, fre-FR, ...)

  • resource String

    eZ Publish resource you want to create alias for

  • path String

    the new alias itself

Example:

var urlAliasCreateStruct = contentService.newUrlAliasCreateStruct(
    "eng-US",
    "content/search",
    "findme-alias"
);

newUrlWildcardCreateStruct

(
  • sourceUrl
  • destinationUrl
  • forward
)

Returns create structure for UrlWildcard

Parameters:

  • sourceUrl String

    new url wildcard

  • destinationUrl String

    existing resource where wildcard should point

  • forward Boolean

    weather or not the wildcard should redirect to the resource

Example:

var urlWildcardCreateStruct = contentService.newUrlWildcardCreateStruct(
    "some-new-wildcard",
    "/api/ezp/v2/content/locations/1/2/113",
    "false"
);

newViewCreateStruct

(
  • identifier
  • [type="ContentQuery"]
)
ViewCreateStruct

Returns create structure for View object

Parameters:

  • identifier String

    unique view identifier (e.g. "my-new-view")

  • [type="ContentQuery"] String optional

    the view type to create

Returns:

publishVersion

(
  • versionedContentId
  • callback
)

Publishes target version of the content.

Parameters:

  • versionedContentId String

    target version identifier (e.g. "/api/ezp/v2/content/objects/108/versions/2")

  • callback Function

    callback executed after performing the request (see Note on the callbacks usage for more info)

recover

(
  • trashItemId
  • [destination]
  • callback
)

Restores target trashItem

Parameters:

  • trashItemId String

    target trash item identifier (e.g. "/api/ezp/v2/content/trash/1")

  • [destination] String optional

    if given the trash item is restored under this location otherwise under its original parent location

  • callback Function

    callback executed after performing the request (see Note on the callbacks usage for more info)

setContentState

(
  • contentStatesId
  • objectStates
  • callback
)

Set ObjectStates of a content

Parameters:

  • contentStatesId String

    link to target content's object states (should be auto-discovered from contentId)

  • objectStates Array
  • callback Function

    callback executed after performing the request (see Note on the callbacks usage for more info)

Example:

contentService.loadObjectState( "/api/ezp/v2/content/objectstategroups/4/objectstates/3", function (error, objectStateResponse) { // possible error should be handled...

        var objectStates = {};
        // Extra odd structure, but it works!
        objectStates.ObjectState = {};
        objectStates.ObjectState.ObjectState = {};
        objectStates.ObjectState.ObjectState = JSON.parse(objectStateResponse.body);

        contentService.setContentState(
            "/api/ezp/v2/content/objects/17/objectstates",
            objectStates,
            callback
        );
    }

);

swapLocation

(
  • subtree
  • targetLocation
  • callback
)

Swaps the location of the "subtree" with "targetLocation"

Parameters:

  • subtree String

    source subtree location

  • targetLocation String

    location with which subtree location should be swapped

  • callback Function

    callback executed after performing the request (see Note on the callbacks usage for more info)

updateContent

(
  • versionedContentId
  • contentUpdateStruct
  • callback
)

Updates the fields of a target draft

Parameters:

  • versionedContentId String

    target version identifier (e.g. "/api/ezp/v2/content/objects/108/versions/2")

  • contentUpdateStruct ContentUpdateStruct

    object describing update to the draft

  • callback Function

    callback executed after performing the request (see Note on the callbacks usage for more info)

updateContentMetadata

(
  • contentId
  • contentMetadataUpdateStruct
  • callback
)

Update target content metadata.

Parameters:

  • contentId String

    target content identifier (e.g. "/api/ezp/v2/content/objects/108")

  • contentMetadataUpdateStruct ContentMetadataUpdateStruct

    object describing update of the content metadata

  • callback Function

    callback executed after performing the request (see Note on the callbacks usage for more info)

Example:

 var updateStruct = contentService.newContentMetadataUpdateStruct("eng-US");

 updateStruct.body.ContentUpdate.Section = "/api/ezp/v2/content/sections/2";
 updateStruct.body.ContentUpdate.remoteId = "new-remote-id";

 contentService.updateContentMetadata(
     "/api/ezp/v2/content/objects/180",
     updateStruct,
     callback
 );

updateLocation

(
  • locationId
  • locationUpdateStruct
  • callback
)

Updates target location

Parameters:

  • locationId String

    target location identifier (e.g. "/api/ezp/v2/content/locations/1/2/102")

  • locationUpdateStruct LocationUpdateStruct

    object describing changes to target location

  • callback Function

    callback executed after performing the request (see Note on the callbacks usage for more info)

updateObjectState

(
  • objectStateId
  • objectStateUpdateStruct
  • callback
)

Update target ObjectState

Parameters:

  • objectStateId String

    target object state identifier (e.g. "/api/ezp/v2/content/objectstategroups/7/objectstates/5")

  • objectStateUpdateStruct ObjectStateUpdateStruct

    object describing changes to target ObjectState

  • callback Function

    callback executed after performing the request (see Note on the callbacks usage for more info)

updateObjectStateGroup

(
  • objectStateGroupId
  • objectStateGroupUpdateStruct
  • callback
)

Update target ObjectState group

Parameters:

  • objectStateGroupId String

    target object state group identifier (e.g. "/api/ezp/v2/content/objectstategroups/2")

  • objectStateGroupUpdateStruct ObjectStateGroupUpdateStruct

    object describing changes to target ObjectState group

  • callback Function

    callback executed after performing the request (see Note on the callbacks usage for more info)

updateSection

(
  • sectionId
  • sectionInputStruct
  • callback
)

Update target section

Parameters:

  • sectionId String

    target section identifier (e.g. "/api/ezp/v2/content/sections/2")

  • sectionInputStruct SectionInputStruct

    object describing updates to the section

  • callback Function

    callback executed after performing the request (see Note on the callbacks usage for more info)