CopyInstanceService methods and messages

In order for an extension to support copying of an instance your extension needs to provide a service url implementing Itslearning.Platform.RestApi.Sdk.Common.Services.CopyInstance.ICopyInstanceService.

There is the only method that needs to be implemented:

Method

Description

CopyInstance

Copies one extension instance to another

CopyInstanceRequest

As a parameter CopyInstance method takes CopyInstanceRequest which includes the following properties:

Method

Description

Context

Type of AuthorizationContext, see detailed description below.

SourceLearningObjectId

Identifier of the extension object to copy. It should already exist on extension side.

TargetLearningObjectId

Identifier of the target object. itslearning has already created it, so the extension side need to ensure that new copy refers to this identifier.

SourceLearningObjectInstanceId

Identifier of the extension object instance to copy. It should already exist on extension side.

TargetLearningObjectInstanceId

Identifier of the target object instance. itslearning has already created it, so the extension side need to ensure that new copy refers to this identifier.

Each request provides both pairs of LearningObjectId and LearningObjectInstanceId, however you can only use one of them depending on your app’s specifics.

AuthorizationContext

Parameter

description

ApiSessionId

The identifier of a valid API session.

CustomerId

The customer identifier which is using this extension.

UserId

The identifier of the person who is adding content to this instance.

UserFirstName

The first name of the person who is adding content to this instance.

UserLastName

The last name of the person who is adding content to this instance.

LearningObjectId

The learning object identifier of the associated instance in itslearning

LearningObjectInstanceId

The learning object instance identifier of the associated instance in itslearning

AllowedHtmlCodeLevel

The permissions this user has on submitting HTML content.

Role

The role of the user.

PersonId

Itslearning identifier of the person who is adding content to this instance.

CopyInstanceResponse

CopyInstanceResponse is the returned type of CopyInstance method. It contains:

Method

Description

LearningObjectId

Id of the newly created extension object if all successfully worked out.

LearningObjectInstanceId

Id of the newly created extension object instance if all successfully worked out.

Succeeded

Boolean value defining whether the operation was successfully performed.

Make sure that LearningObjectId and LearningObjectInstanceId are valid and refers to the ones provided by CopyInstanceRequest - TargetLearningObjectId and TargetLearningObjectInstanceId.

Implementation example

The itslearning SDK contains examples of .NET service contracts that can help with implementing the web services. Please refer to ICopyInstanceService interface included in the SDK. There is also AuthenticationInspector class, that contains logic for signing requests and verifying signatures. It can be specified in web service's web.config file as a behavior element, please find the example in Extend your application with import abilities .

This is an example of how it can be implemented in the web service (C#):

images/download/attachments/23891218/quiz.png