Jump to: navigation, search

Difference between revisions of "UBIK Web Service"


 
(35 intermediate revisions by 2 users not shown)
Line 1: Line 1:
Web Service Documentation
+
The following section describes the most important UBIK Webservice Methods used for
 +
* Fetching information about the Datamodell (Fetch MetaDefinitions)
 +
* Downloading Content objects (Download Content)
 +
* Downloading Content File Documents (Download Document)
 +
* Creating a single Content object (Create Content)
 +
* Updating Content objects (Update Contents)
 +
* Uploading a file Document (Upload Document )
 +
* CheckOur and release a set of Contents objects
  
== Fetch MetaDefinitions ==
 
  
Provides the configured ACM (see [[Application_Context_Management]]) Datemodell to the client.
+
= Fetch MetaDefinitions =
 +
== Fetch MetaDefinitions ==
 +
Provides the configured ACM (see [[Application_Context_Management]]) data model to the client.
  
 
<source lang="csharp">
 
<source lang="csharp">
Line 26: Line 34:
  
  
=== List ofParameters ===
+
=== List of Parameters ===
 
{| class="wikitable" | width = "50%"
 
{| class="wikitable" | width = "50%"
 
|-  
 
|-  
Line 42: Line 50:
  
  
=== Code Example (c#) ===
+
=== Code Example (C#) ===
 
<source lang="csharp">
 
<source lang="csharp">
 
string appName = "APP_TEST";
 
string appName = "APP_TEST";
Line 61: Line 69:
  
  
 +
= Download Content =
 
== Download Content ==
 
== Download Content ==
 
 
GetHierarchyDeltasV212 is used for downloading single objects as well as branches, root objects and the infrastructure.
 
GetHierarchyDeltasV212 is used for downloading single objects as well as branches, root objects and the infrastructure.
  
Line 77: Line 85:
 
         /// <returns>a set of content objects</returns>
 
         /// <returns>a set of content objects</returns>
 
         [OperationContract]
 
         [OperationContract]
         [WebInvoke(UriTemplate = "GetMetaDefinitionsV212/{appName}/{contextName}/{authentication}/{version}", Method = "GET",
+
         [WebInvoke(UriTemplate = "GetHierarchyDeltasV212/{appName}/{contextName}/{authentication}/{version}", Method = "POST",
 
                   RequestFormat = WebMessageFormat.Json,
 
                   RequestFormat = WebMessageFormat.Json,
 +
                  BodyStyle = WebMessageBodyStyle.Bare,
 
                   ResponseFormat = WebMessageFormat.Json)]
 
                   ResponseFormat = WebMessageFormat.Json)]
 
   
 
   
Line 90: Line 99:
  
  
=== List ofParameters ===
+
=== List of Parameters ===
 
{| class="wikitable" | width = "50%"
 
{| class="wikitable" | width = "50%"
 
|-  
 
|-  
Line 106: Line 115:
 
|-  
 
|-  
 
|}
 
|}
 +
 +
== Code Examples ==
 +
 +
=== Downloading Root Objects ===
 +
==== HTTP (REST) ====
 +
<source lang="html4strict" style="padding-bottom: 0; border-bottom: 0;">
 +
POST <CONTENT-PATH>/UBIKContent.svc/GetHierarchyDeltasV212/<APP>/<CTX>/<TOKEN>/<VERSION> HTTP/1.1
 +
Host: <HOSTNAME/IP>:<PORT>
 +
Content-Type: application/json
 +
</source>
 +
<source lang="javascript" style="padding-top: 0; border-top: 0;">
 +
{
 +
    "StartingPoint": {
 +
        "__type": "HierarchyRoot:#UBIK.Service.DTO.V211"
 +
    },
 +
    "ParentDepth": 0,
 +
    "ChildrenDepth": 1,
 +
    "KnownRelations": null,
 +
    "KnownContents": null
 +
}
 +
</source>
 +
Make sure to replace the <code><tags></code> accordingly!
 +
 +
The <code>__type</code> property allows the JSON deserializer to find the correct class. [[https://docs.microsoft.com/en-us/dotnet/framework/wcf/feature-details/stand-alone-json-serialization?redirectedfrom=MSDN#polymorphism-1| Microsoft Documentation]].
 +
 +
 +
 +
==== SOAP ====
 +
<source lang="html4strict" style="padding-bottom: 0; border-bottom: 0;">
 +
<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tem="http://tempuri.org/" xmlns:ubik="http://schemas.datacontract.org/2004/07/UBIK.Service.DTO.V211" xmlns:ubik1="http://schemas.datacontract.org/2004/07/UBIK.Service" xmlns:arr="http://schemas.microsoft.com/2003/10/Serialization/Arrays" xmlns:ubik2="http://schemas.datacontract.org/2004/07/UBIK.Service.DTO.V244" xmlns:ubik3="http://schemas.datacontract.org/2004/07/UBIK.Service.DTO.V260">
 +
  <soapenv:Header/>
 +
  <soapenv:Body>
 +
      <tem:GetHierarchyDeltasV212>
 +
        <tem:appName>application</tem:appName>
 +
        <tem:contextName>context</tem:contextName>
 +
        <tem:args>
 +
            <ubik:ChildrenDepth>1</ubik:ChildrenDepth>
 +
            <ubik:ParentDepth>0</ubik:ParentDepth>
 +
            <ubik:StartingPoint xsi:type="ubik:HierarchyRoot"/>          
 +
        </tem:args>
 +
        <tem:authentication>authttoken</tem:authentication>
 +
        <tem:version>264</tem:version>
 +
      </tem:GetHierarchyDeltasV212>
 +
  </soapenv:Body>
 +
</soapenv:Envelope>
 +
 +
</source>
 +
 +
Make sure to replace the application, context and authtoken accordingly!
  
  
=== Code Example (c#) ===
 
Downloading Root Objects
 
  
 +
==== C# ====
 
<source lang="csharp">
 
<source lang="csharp">
 
string appName = "APP_TEST";
 
string appName = "APP_TEST";
Line 136: Line 193:
  
  
Downloading Infrastructure Objects
+
=== Downloading Infrastructure Objects ===
 +
==== HTTP (REST) ====
 +
<source lang="html4strict" style="padding-bottom: 0; border-bottom: 0;">
 +
POST <CONTENT-PATH>/UBIKContent.svc/GetHierarchyDeltasV212/<APP>/<CTX>/<TOKEN>/<VERSION> HTTP/1.1
 +
Host: <HOSTNAME/IP>:<PORT>
 +
Content-Type: application/json
 +
</source>
 +
<source lang="javascript" style="padding-top: 0; border-top: 0;">
 +
{
 +
    "StartingPoint": {
 +
        "__type": "HierarchyInfrastructure:#UBIK.Service.DTO.V211"
 +
    },
 +
    "ParentDepth": 0,
 +
    "ChildrenDepth": 1,
 +
    "KnownRelations": null,
 +
    "KnownContents": null
 +
}
 +
</source>
 +
Make sure to replace the <code><tags></code> accordingly!
 +
 
 +
 
 +
 
 +
==== SOAP ====
 +
<source lang="html4strict" style="padding-bottom: 0; border-bottom: 0;">
 +
<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tem="http://tempuri.org/" xmlns:ubik="http://schemas.datacontract.org/2004/07/UBIK.Service.DTO.V211" xmlns:ubik1="http://schemas.datacontract.org/2004/07/UBIK.Service" xmlns:arr="http://schemas.microsoft.com/2003/10/Serialization/Arrays" xmlns:ubik2="http://schemas.datacontract.org/2004/07/UBIK.Service.DTO.V244" xmlns:ubik3="http://schemas.datacontract.org/2004/07/UBIK.Service.DTO.V260">
 +
  <soapenv:Header/>
 +
  <soapenv:Body>
 +
      <tem:GetHierarchyDeltasV212>
 +
        <tem:appName>application</tem:appName>
 +
        <tem:contextName>context</tem:contextName>
 +
        <tem:args>
 +
            <ubik:ChildrenDepth>1</ubik:ChildrenDepth>
 +
            <ubik:ParentDepth>0</ubik:ParentDepth>
 +
            <ubik:StartingPoint xsi:type="ubik:HierarchyInfrastructure"/>          
 +
        </tem:args>
 +
        <tem:authentication>authttoken</tem:authentication>
 +
        <tem:version>264</tem:version>
 +
      </tem:GetHierarchyDeltasV212>
 +
  </soapenv:Body>
 +
</soapenv:Envelope>
 +
</source>
 +
 
 +
Make sure to replace the application, context and authtoken accordingly!
  
 +
==== C#====
 
<source lang="csharp">
 
<source lang="csharp">
 
string appName = "APP_TEST";
 
string appName = "APP_TEST";
Line 163: Line 263:
  
  
Downloading an entire branch starting at object with UID = '9E8FC21E-137E-4DDB-9D85-6E71B01F12FA'
+
=== Downloading branch ===
 +
The branch starting at object with UID = '9E8FC21E-137E-4DDB-9D85-6E71B01F12FA' will be downloaded.
  
 +
==== HTTP (REST) ====
 +
<source lang="html4strict" style="padding-bottom: 0; border-bottom: 0;">
 +
POST <CONTENT-PATH>/UBIKContent.svc/GetHierarchyDeltasV212/<APP>/<CTX>/<TOKEN>/<VERSION> HTTP/1.1
 +
Host: <HOSTNAME/IP>:<PORT>
 +
Content-Type: application/json
 +
</source>
 +
<source lang="javascript" style="padding-top: 0; border-top: 0;">
 +
{
 +
    "StartingPoint": {
 +
        "__type": "HierarchyStartingPoint:#UBIK.Service.DTO.V211",
 +
        "UID": "9E8FC21E-137E-4DDB-9D85-6E71B01F12FA"
 +
    },
 +
    "ParentDepth": 0,
 +
    "ChildrenDepth": 1,
 +
    "KnownRelations": null,
 +
    "KnownContents": null
 +
}
 +
</source>
 +
 +
==== SOAP ====
 +
<source lang="html4strict" style="padding-bottom: 0; border-bottom: 0;">
 +
<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tem="http://tempuri.org/" xmlns:ubik="http://schemas.datacontract.org/2004/07/UBIK.Service.DTO.V211" xmlns:ubik1="http://schemas.datacontract.org/2004/07/UBIK.Service" xmlns:arr="http://schemas.microsoft.com/2003/10/Serialization/Arrays" xmlns:ubik2="http://schemas.datacontract.org/2004/07/UBIK.Service.DTO.V244" xmlns:ubik3="http://schemas.datacontract.org/2004/07/UBIK.Service.DTO.V260">
 +
  <soapenv:Header/>
 +
  <soapenv:Body>
 +
      <tem:GetHierarchyDeltasV212>
 +
        <tem:appName>APP_TEST</tem:appName>
 +
        <tem:contextName>CTX_TEST</tem:contextName>
 +
        <tem:args>
 +
            <ubik:ChildrenDepth>1</ubik:ChildrenDepth>
 +
            <ubik:ParentDepth>0</ubik:ParentDepth>
 +
            <ubik:StartingPoint xsi:type="ubik:HierarchyStartingPoint">
 +
                    <ubik:UID>9E8FC21E-137E-4DDB-9D85-6E71B01F12FA</ubik:UID>
 +
  </ubik:StartingPoint>          
 +
        </tem:args>
 +
        <tem:authentication>authttoken</tem:authentication>
 +
        <tem:version>264</tem:version>
 +
      </tem:GetHierarchyDeltasV212>
 +
  </soapenv:Body>
 +
</soapenv:Envelope>
 +
</source>
 +
 +
Make sure to replace the application, context and authtoken accordingly!
 +
 +
 +
 +
==== C# ====
 
<source lang="csharp">
 
<source lang="csharp">
 
string appName = "APP_TEST";
 
string appName = "APP_TEST";
 
string contextName = "CTX_TEST";
 
string contextName = "CTX_TEST";
 
string authToken = FetchValidAuthToken();
 
string authToken = FetchValidAuthToken();
string version = "263";
+
string version = "264";
  
 
HierarchyDeltaArguments args = new HierarchyDeltaArguments()
 
HierarchyDeltaArguments args = new HierarchyDeltaArguments()
Line 190: Line 337:
  
  
 
+
= Download a Document =
 
+
 
== Download a Document ==
 
== Download a Document ==
 
 
Method provides a stream to the document referenced by the contentId.
 
Method provides a stream to the document referenced by the contentId.
  
Line 223: Line 368:
 
</source>
 
</source>
  
=== List ofParameters ===
+
=== List of Parameters ===
 
{| class="wikitable" | width = "50%"
 
{| class="wikitable" | width = "50%"
 
|-  
 
|-  
Line 240: Line 385:
 
|}
 
|}
  
=== Code Example (c#) ===
+
=== Code Example (C#) ===
 
<source lang="csharp">
 
<source lang="csharp">
 
string appName = "APP_TEST";
 
string appName = "APP_TEST";
Line 281: Line 426:
  
  
 +
= Create a single Content =
 
== Create a single Content ==
 
== Create a single Content ==
  
Line 314: Line 460:
  
  
=== List ofParameters ===
+
=== List of Parameters ===
 
{| class="wikitable" | width = "50%"
 
{| class="wikitable" | width = "50%"
 
|-  
 
|-  
Line 334: Line 480:
  
  
=== Code Example (c#) ===
+
=== Code Example (C#) ===
 
<source lang="csharp">
 
<source lang="csharp">
 
string appName = "APP_TEST";
 
string appName = "APP_TEST";
Line 384: Line 530:
  
  
 +
= Update Contents =
 
== Update Contents ==
 
== Update Contents ==
  
Line 411: Line 558:
 
</source>
 
</source>
  
=== List ofParameters ===
+
=== List of Parameters ===
 
{| class="wikitable" | width = "50%"
 
{| class="wikitable" | width = "50%"
 
|-  
 
|-  
Line 428: Line 575:
 
|}
 
|}
  
=== Code Example (c#) ===
+
==== HTTP (REST) ====
 +
<source lang="html4strict" style="padding-bottom: 0; border-bottom: 0;">
 +
POST <CONTENT-PATH>/UBIKContent.svc/UpdateContentListV212/<APP>/<CTX>/<TOKEN>/<VERSION> HTTP/1.1
 +
Host: <HOSTNAME/IP>:<PORT>
 +
Content-Type: application/json
 +
</source>
 +
<source lang="javascript" style="padding-top: 0; border-top: 0;">
 +
[
 +
    {
 +
        "__type": "UbikContent:#UBIK.Service.DTO.V260",
 +
        "UID": "c02e668b-d400-41df-b7bc-ab3f1f31d250",
 +
        "PropertyValues":
 +
        [
 +
            {
 +
                "__type": "TypePropertyValueOfstring:#UBIK.Service",
 +
                "MetaPropertyID": "4ec5281a-e0bd-4917-aff5-708352fc6953",
 +
                "ValidationTS":"/Date(1569942000000+0200)/",
 +
                "Value": "TESTVALUE"
 +
            },
 +
            {
 +
                "__type": "TypePropertyValueOfNullableOfint:#UBIK.Service",
 +
                "MetaPropertyID": "7c95ec83-a399-4b47-b827-6d87795a7b19",
 +
                "ValidationTS":"/Date(1569942000000+0200)/",
 +
                "Value": 33
 +
            }
 +
        ]
 +
    }
 +
]
 +
</source>
 +
Make sure to replace the <code><tags></code> accordingly!
 +
 
 +
The <code>__type</code> property allows the JSON deserializer to find the correct class. [[https://docs.microsoft.com/en-us/dotnet/framework/wcf/feature-details/stand-alone-json-serialization?redirectedfrom=MSDN#polymorphism-1| Microsoft Documentation]].
 +
 
 +
 
 +
 
 +
=== Code Example (C#) ===
 
<source lang="csharp">
 
<source lang="csharp">
 
string appName = "APP_TEST";
 
string appName = "APP_TEST";
Line 473: Line 655:
  
  
 
+
= Upload Document =
 
+
 
== Upload Document ==
 
== Upload Document ==
 
 
Method for updating a set of content objects and retrieving the updated objects as result
 
Method for updating a set of content objects and retrieving the updated objects as result
  
Line 496: Line 676:
 
</source>
 
</source>
  
=== List ofParameters ===
+
=== List of Parameters ===
 
{| class="wikitable" | width = "50%"
 
{| class="wikitable" | width = "50%"
 
|-  
 
|-  
 
! Name!! Type !! Description
 
! Name!! Type !! Description
 
|-  
 
|-  
| appName|| String || Name of the Application (mujst be specified in the header)
+
| appName|| String || Name of the Application (must be specified in the header)
 
|-  
 
|-  
| contextName|| String || Name of the Context (mujst be specified in the header)
+
| contextName|| String || Name of the Context (must be specified in the header)
 
|-  
 
|-  
| authentication|| String || Valid auth token (mujst be specified in the header)
+
| authentication|| String || Valid auth token (must be specified in the header)
 
|-  
 
|-  
| fileTypeValue|| String || FileType of the uploaded file (mujst be specified in the header)
+
| fileTypeValue|| String || FileType of the uploaded file (must be specified in the header)
 
|-  
 
|-  
| documentId|| String || UID of the related Content Instance (mujst be specified in the header)
+
| documentId|| String || UID of the related Content Instance (must be specified in the header)
 
|-  
 
|-  
| version|| String || Indicator of the expected data format version (mujst be specified in the header)
+
| version|| String || Indicator of the expected data format version (must be specified in the header)
 
|-  
 
|-  
 
|}
 
|}
  
=== Code Example (c#) ===
+
=== Code Example (C#) ===
 
<source lang="csharp">
 
<source lang="csharp">
 
string appName = "APP_TEST";
 
string appName = "APP_TEST";
Line 551: Line 731:
 
}
 
}
 
</source>
 
</source>
 +
 +
 +
= Exclusive Access =
 +
== CheckOut ==
 +
Tries to get exclusive access to all provided contents.
 +
 +
<source lang="csharp">
 +
        [OperationContract]
 +
        [WebInvoke(UriTemplate = "CheckOut/{appName}/{contextName}/{authentication}/{version}", Method = "POST",
 +
                  RequestFormat = WebMessageFormat.Json,
 +
                  BodyStyle = WebMessageBodyStyle.Bare,
 +
                  ResponseFormat = WebMessageFormat.Json)]
 +
 +
        BCDataShipments CheckOut(
 +
                            string appName,
 +
                            string contextName,
 +
                            string authentication,
 +
                            UbikContent[] contents,
 +
                            string version);
 +
</source>
 +
 +
 +
=== List of Parameters ===
 +
{| class="wikitable" | width = "50%"
 +
|-
 +
! Name!! Type !! Description
 +
|-
 +
| appName|| String || Name of the Application
 +
|-
 +
| contextName|| String || Name of the Context
 +
|-
 +
| authentication|| String || Valid auth token
 +
|-
 +
| contents|| UbikContent[] || Content objects to be checked out
 +
|-
 +
| version|| String || Indicator of the expected data format version
 +
|-
 +
|}
 +
 +
 +
=== Code Example (C#) ===
 +
<source lang="csharp">
 +
string appName = "APP_TEST";
 +
string contextName = "CTX_TEST";
 +
string authToken = FetchValidAuthToken();
 +
string version = "362";
 +
 +
        UbikContent content = new UbikContent()
 +
        {
 +
                // reference to the MetaDefinition
 +
                MetaClassID = new Guid("6b4bd904-8504-4e05-93dd-ae120d15a5be"),
 +
                //  object => we must use the UID of an existing content object
 +
                UID = new Guid("6b4bd904-8504-4e05-93dd-ae120d15a5be")
 +
        };
 +
 +
UBIKContentClient target = new UBIKContentClient(WEBSERVER_NAME);
 +
 +
BCDataShipments result = target.CheckOut(
 +
                              appName,
 +
                              contextName,
 +
                              authToken,
 +
                              new UbikContent[] { content },
 +
                              version);
 +
</source>
 +
 +
== Release ==
 +
Tries to release the exclusive access to all provided contents.
 +
 +
<source lang="csharp">
 +
        [OperationContract]
 +
        [WebInvoke(UriTemplate = "Release/{appName}/{contextName}/{authentication}/{version}", Method = "POST",
 +
                  RequestFormat = WebMessageFormat.Json,
 +
                  BodyStyle = WebMessageBodyStyle.Bare,
 +
                  ResponseFormat = WebMessageFormat.Json)]
 +
 +
        BCDataShipments Release(
 +
                            string appName,
 +
                            string contextName,
 +
                            string authentication,
 +
                            UbikContent[] contents,
 +
                            string version);
 +
</source>
 +
 +
 +
=== List of Parameters ===
 +
{| class="wikitable" | width = "50%"
 +
|-
 +
! Name!! Type !! Description
 +
|-
 +
| appName|| String || Name of the Application
 +
|-
 +
| contextName|| String || Name of the Context
 +
|-
 +
| authentication|| String || Valid auth token
 +
|-
 +
| contents|| UbikContent[] || Content objects to be checked out
 +
|-
 +
| version|| String || Indicator of the expected data format version
 +
|-
 +
|}
 +
 +
 +
=== Code Example (C#) ===
 +
<source lang="csharp">
 +
string appName = "APP_TEST";
 +
string contextName = "CTX_TEST";
 +
string authToken = FetchValidAuthToken();
 +
string version = "362";
 +
 +
        UbikContent content = new UbikContent()
 +
        {
 +
                // reference to the MetaDefinition
 +
                MetaClassID = new Guid("6b4bd904-8504-4e05-93dd-ae120d15a5be"),
 +
                //  object => we must use the UID of an existing content object
 +
                UID = new Guid("6b4bd904-8504-4e05-93dd-ae120d15a5be")
 +
        };
 +
 +
UBIKContentClient target = new UBIKContentClient(WEBSERVER_NAME);
 +
 +
BCDataShipments result = target.Release(
 +
                              appName,
 +
                              contextName,
 +
                              authToken,
 +
                              new UbikContent[] { content },
 +
                              version);
 +
</source>
 +
 +
<headertabs />
  
 
[[Category:Server|Web Service]]
 
[[Category:Server|Web Service]]

Latest revision as of 16:30, 4 April 2022

The following section describes the most important UBIK Webservice Methods used for

  • Fetching information about the Datamodell (Fetch MetaDefinitions)
  • Downloading Content objects (Download Content)
  • Downloading Content File Documents (Download Document)
  • Creating a single Content object (Create Content)
  • Updating Content objects (Update Contents)
  • Uploading a file Document (Upload Document )
  • CheckOur and release a set of Contents objects


[edit]

Fetch MetaDefinitions

Fetch MetaDefinitions

Provides the configured ACM (see Application Context Management) data model to the client.

        /// <summary>
        /// Delivers a list of all defined MetaClass Objects for the given Application and the given DeviceID
        /// </summary>
        /// <param name="appName">Name of the Application</param>
        /// <param name="contextName">Name of the Context</param>
        /// <param name="authentication">authentication (tokenid) for the user/device to access this service</param>
        /// <returns>a list of MetaDefinitions</returns>
        [OperationContract]
        [WebInvoke(UriTemplate = "GetMetaDefinitionsV212/{appName}/{contextName}/{authentication}/{version}", Method = "GET",
                   RequestFormat = WebMessageFormat.Json,
                   ResponseFormat = WebMessageFormat.Json)]
                                   
        BCMetaDefinitions GetMetaDefinitionsV212(
                                                        String appName,
                                                        String contextName,
                                                        String authentication,
                                                        String version);


List of Parameters

Name Type Description
appName String Name of the Application
contextName String Name of the Context
authentication String Valid auth token
version String Indicator of the expected data format version


Code Example (C#)

        string appName = "APP_TEST";
        string contextName = "CTX_TEST";
        string authToken = FetchValidAuthToken();
        string version = "263";

        UBIKContentClient target = new UBIKContentClient(WEBSERVER_NAME);
       
        BCMetaDefinitions metaDefintions = target.GetMetaDefinitionsV212(
                                                                        appName,
                                                                        contextName,
                                                                        authToken,
                                                                        version);



Download Content

Download Content

GetHierarchyDeltasV212 is used for downloading single objects as well as branches, root objects and the infrastructure.

        /// <summary>
        /// The main method for downloading content.
        /// This method is used for downloading single objects as well as branches, root objects and the infrastructure
        /// </summary>
        /// <param name="appName">Name of the application.</param>
        /// <param name="contextName">Name of the context.</param>
        /// <param name="args">The arguments.</param>
        /// <param name="authentication">authentication (tokenid) for the user/device to access this service</param>
        /// <param name="version">The versionindicator.</param>
        /// <returns>a set of content objects</returns>
        [OperationContract]
        [WebInvoke(UriTemplate = "GetHierarchyDeltasV212/{appName}/{contextName}/{authentication}/{version}", Method = "POST",
                   RequestFormat = WebMessageFormat.Json,
                   BodyStyle = WebMessageBodyStyle.Bare,
                   ResponseFormat = WebMessageFormat.Json)]
                                   
        BCHierarchyDeltaShipments GetHierarchyDeltasV212(
                                                        String appName,
                                                        String contextName,
                                                        HierarchyDeltaArguments args,
                                                        String authentication,
                                                        String version);


List of Parameters

Name Type Description
appName String Name of the Application
contextName String Name of the Context
args HierarchyDeltaArguments Defines the type of download (root, infra, branch) as well as the startobject and the download depth
authentication String Valid auth token
version String Indicator of the expected data format version

Code Examples

Downloading Root Objects

HTTP (REST)

POST <CONTENT-PATH>/UBIKContent.svc/GetHierarchyDeltasV212/<APP>/<CTX>/<TOKEN>/<VERSION> HTTP/1.1
Host: <HOSTNAME/IP>:<PORT>
Content-Type: application/json
{
    "StartingPoint": {
        "__type": "HierarchyRoot:#UBIK.Service.DTO.V211"
    },
    "ParentDepth": 0,
    "ChildrenDepth": 1,
    "KnownRelations": null,
    "KnownContents": null
}

Make sure to replace the <tags> accordingly!

The __type property allows the JSON deserializer to find the correct class. [Microsoft Documentation].


SOAP

<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tem="http://tempuri.org/" xmlns:ubik="http://schemas.datacontract.org/2004/07/UBIK.Service.DTO.V211" xmlns:ubik1="http://schemas.datacontract.org/2004/07/UBIK.Service" xmlns:arr="http://schemas.microsoft.com/2003/10/Serialization/Arrays" xmlns:ubik2="http://schemas.datacontract.org/2004/07/UBIK.Service.DTO.V244" xmlns:ubik3="http://schemas.datacontract.org/2004/07/UBIK.Service.DTO.V260">
   <soapenv:Header/>
   <soapenv:Body>
      <tem:GetHierarchyDeltasV212>
         <tem:appName>application</tem:appName>
         <tem:contextName>context</tem:contextName>
         <tem:args>
            <ubik:ChildrenDepth>1</ubik:ChildrenDepth>
            <ubik:ParentDepth>0</ubik:ParentDepth>
            <ubik:StartingPoint xsi:type="ubik:HierarchyRoot"/>                                  
         </tem:args>
         <tem:authentication>authttoken</tem:authentication>
         <tem:version>264</tem:version>
      </tem:GetHierarchyDeltasV212>
   </soapenv:Body>
</soapenv:Envelope>

Make sure to replace the application, context and authtoken accordingly!


C#

        string appName = "APP_TEST";
        string contextName = "CTX_TEST";
        string authToken = FetchValidAuthToken();
        string version = "263";

        HierarchyDeltaArguments args = new HierarchyDeltaArguments()
        {
                ChildrenDepth = 1,
                ParentDepth = 0,
                StartingPoint = new HierarchyRoot(),
        };
       
        UBIKContentClient target = new UBIKContentClient(WEBSERVER_NAME);
       
        BCHierarchyDeltaShipments roots = target.GetHierarchyDeltasV212(
                                                                        appName,
                                                                        contextName,
                                                                        args,
                                                                        authToken,
                                                                        version);


Downloading Infrastructure Objects

HTTP (REST)

POST <CONTENT-PATH>/UBIKContent.svc/GetHierarchyDeltasV212/<APP>/<CTX>/<TOKEN>/<VERSION> HTTP/1.1
Host: <HOSTNAME/IP>:<PORT>
Content-Type: application/json
{
    "StartingPoint": {
        "__type": "HierarchyInfrastructure:#UBIK.Service.DTO.V211"
    },
    "ParentDepth": 0,
    "ChildrenDepth": 1,
    "KnownRelations": null,
    "KnownContents": null
}

Make sure to replace the <tags> accordingly!


SOAP

<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tem="http://tempuri.org/" xmlns:ubik="http://schemas.datacontract.org/2004/07/UBIK.Service.DTO.V211" xmlns:ubik1="http://schemas.datacontract.org/2004/07/UBIK.Service" xmlns:arr="http://schemas.microsoft.com/2003/10/Serialization/Arrays" xmlns:ubik2="http://schemas.datacontract.org/2004/07/UBIK.Service.DTO.V244" xmlns:ubik3="http://schemas.datacontract.org/2004/07/UBIK.Service.DTO.V260">
   <soapenv:Header/>
   <soapenv:Body>
      <tem:GetHierarchyDeltasV212>
         <tem:appName>application</tem:appName>
         <tem:contextName>context</tem:contextName>
         <tem:args>
            <ubik:ChildrenDepth>1</ubik:ChildrenDepth>
            <ubik:ParentDepth>0</ubik:ParentDepth>
            <ubik:StartingPoint xsi:type="ubik:HierarchyInfrastructure"/>                                        
         </tem:args>
         <tem:authentication>authttoken</tem:authentication>
         <tem:version>264</tem:version>
      </tem:GetHierarchyDeltasV212>
   </soapenv:Body>
</soapenv:Envelope>

Make sure to replace the application, context and authtoken accordingly!

C#

        string appName = "APP_TEST";
        string contextName = "CTX_TEST";
        string authToken = FetchValidAuthToken();
        string version = "263";

        HierarchyDeltaArguments args = new HierarchyDeltaArguments()
        {
                ChildrenDepth = 1,
                ParentDepth = 0,
                StartingPoint = new HierarchyInfrastructure(),
        };
       
        UBIKContentClient target = new UBIKContentClient(WEBSERVER_NAME);
       
        BCHierarchyDeltaShipments roots = target.GetHierarchyDeltasV212(
                                                                        appName,
                                                                        contextName,
                                                                        args,
                                                                        authToken,
                                                                        version);


Downloading branch

The branch starting at object with UID = '9E8FC21E-137E-4DDB-9D85-6E71B01F12FA' will be downloaded.

HTTP (REST)

POST <CONTENT-PATH>/UBIKContent.svc/GetHierarchyDeltasV212/<APP>/<CTX>/<TOKEN>/<VERSION> HTTP/1.1
Host: <HOSTNAME/IP>:<PORT>
Content-Type: application/json
{
    "StartingPoint": {
        "__type": "HierarchyStartingPoint:#UBIK.Service.DTO.V211",
        "UID": "9E8FC21E-137E-4DDB-9D85-6E71B01F12FA"
    },
    "ParentDepth": 0,
    "ChildrenDepth": 1,
    "KnownRelations": null,
    "KnownContents": null
}

SOAP

<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tem="http://tempuri.org/" xmlns:ubik="http://schemas.datacontract.org/2004/07/UBIK.Service.DTO.V211" xmlns:ubik1="http://schemas.datacontract.org/2004/07/UBIK.Service" xmlns:arr="http://schemas.microsoft.com/2003/10/Serialization/Arrays" xmlns:ubik2="http://schemas.datacontract.org/2004/07/UBIK.Service.DTO.V244" xmlns:ubik3="http://schemas.datacontract.org/2004/07/UBIK.Service.DTO.V260">
   <soapenv:Header/>
   <soapenv:Body>
      <tem:GetHierarchyDeltasV212>
         <tem:appName>APP_TEST</tem:appName>
         <tem:contextName>CTX_TEST</tem:contextName>
         <tem:args>
            <ubik:ChildrenDepth>1</ubik:ChildrenDepth>
            <ubik:ParentDepth>0</ubik:ParentDepth>
            <ubik:StartingPoint xsi:type="ubik:HierarchyStartingPoint">                        
                     <ubik:UID>9E8FC21E-137E-4DDB-9D85-6E71B01F12FA</ubik:UID>
           </ubik:StartingPoint>                                 
         </tem:args>
         <tem:authentication>authttoken</tem:authentication>
         <tem:version>264</tem:version>
      </tem:GetHierarchyDeltasV212>
   </soapenv:Body>
</soapenv:Envelope>

Make sure to replace the application, context and authtoken accordingly!


C#

        string appName = "APP_TEST";
        string contextName = "CTX_TEST";
        string authToken = FetchValidAuthToken();
        string version = "264";

        HierarchyDeltaArguments args = new HierarchyDeltaArguments()
        {
                ChildrenDepth = 1,
                ParentDepth = 0,
                StartingPoint = new HierarchyStartingPoint(new Guid("9E8FC21E-137E-4DDB-9D85-6E71B01F12FA"))
        };
       
        UBIKContentClient target = new UBIKContentClient(WEBSERVER_NAME);
       
        BCHierarchyDeltaShipments roots = target.GetHierarchyDeltasV212(
                                                                        appName,
                                                                        contextName,
                                                                        args,
                                                                        authToken,
                                                                        version);


Download a Document

Download a Document

Method provides a stream to the document referenced by the contentId.

        /// <summary>
        /// Provides a stream to the document referenced by the contentId.
        /// </summary>
        /// <param name="appName">Name of the application</param>
        /// <param name="contextName">Name of the context</param>
        /// <param name="documentId">ID of the document content object</param>
        /// <param name="authentication">authentication (tokenid) for the user/device to access this service</param>
        /// <param name="version">Client Web Service Version number</param>
        /// <returns>A stream of the document</returns>
               
        [OperationContract]
        [WebInvoke(UriTemplate = "DownloadDocumentV212/{appName}/{contextName}/{documentId}/{authentication}/{version}", Method = "GET",
                   RequestFormat = WebMessageFormat.Json,
                   ResponseFormat = WebMessageFormat.Json)]
                                   
        Stream DownloadDocumentV212(
                                                String appName,
                                                String contextName,
                                                String documentId,
                                                String authentication,
                                                String version);

List of Parameters

Name Type Description
appName String Name of the Application
contextName String Name of the Context
documentId String ID of the document to be downloaded
authentication String Valid auth token
version String Indicator of the expected data format version

Code Example (C#)

        string appName = "APP_TEST";
        string ctxName = "CTX_TEST";
        string authToken = FetchValidAuthToken();
        string version = "263";
       
        Guid documentId = new Guid("61ba9775-c724-40ca-b5e1-7119ab9ab553");
        string filePath = "any File Path hrere";
        string fileType = "*.xml";
       
        Stream stream = null;
        try
        {
                // ID of the object to be downloaded
                Guid documentId = new Guid("61ba9775-c724-40ca-b5e1-7119ab9ab553");

                UBIKContentClient target = new UBIKContentClient(WEBSERVER_NAME);
               
                stream = target.DownloadDocumentV212(
                                                                appName,
                                                                ctxName,
                                                                documentId.ToString(),
                                                                authToken,
                                                                version);
               
                streamReader = new StreamReader(stream);
                string downloadedContent = streamReader.ReadToEnd();           
        }
        finally
        {
                if (stream != null)
                        stream.Close();
        }




Create a single Content

Create a single Content

Method for creating a single content object and retrieving the new object as result

        /// <summary>
        /// Member for creating a single content object and retrieving the new object as result
        /// </summary>
        /// <param name="appName">The name of the application</param>
        /// <param name="contextName">The name of the context the view hierarchy is defined in</param>
        /// <param name="ownerID">UID of the owner object to create the new content as child</param>
        /// <param name="authentication">The (valid) authentication token</param>
        /// <param name="dataShipment">Data container bringing all the necessary data for creating a singe content object</param>
        /// <param name="version">Client Web Service Version number</param>
        /// <returns>the new content object as BCDataShipment</returns>
               
        [OperationContract]
        [WebInvoke(UriTemplate = "CreateSingleContentV212/{appName}/{contextName}/{ownerID}/{authentication}/{version}", Method = "POST",
                   RequestFormat = WebMessageFormat.Json,
                   BodyStyle = WebMessageBodyStyle.Bare,
                   ResponseFormat = WebMessageFormat.Json)]
                                   
        BCDataShipment CreateSingleContentV212(
                                                        String appName,
                                                        String contextName,
                                                        String ownerID,
                                                        String authentication,
                                                        UbikContent dataShipment,
                                                        String version);


List of Parameters

Name Type Description
appName String Name of the Application
contextName String Name of the Context
ownerID String ID of the owner object the new content is related to (as a child)
authentication String Valid auth token
dataShipment UbikContent Content of the new object (MetaInformation and Property - Values)
version String Indicator of the expected data format version


Code Example (C#)

        string appName = "APP_TEST";
        string ctxName = "CTX_TEST";
        string authToken = FetchValidAuthToken();
        string version = "263";
       
        // ID of the owner object the new content is related to (as a child)
        string ownerID = new Guid("533f1ca1-0ee0-424f-a115-0a09bbfaa6de").ToString();

        UbikContent newContent = new UbikContent()
        {
                // reference to the MetaDefinition
                MetaClassID = new Guid("6b4bd904-8504-4e05-93dd-ae120d15a5be"),
                // new Object => create a new UID
                UID = Guid.NewGuid()
        };

        newContent.PropertyValues = new UBIK.Service.PropertyValue[]
                {
                        new TypePropertyValue<string>()
                        {
                                // value to set
                                Value = "TESTVALUE",
                                // reference to the MetaProperty definition
                                MetaPropertyID = new Guid("4ec5281a-e0bd-4917-aff5-708352fc6953")},

                        new TypePropertyValue<int?>()
                        {
                                // value to set
                                Value = int.MaxValue,
                                // reference to the MetaProperty definition
                                MetaPropertyID = new Guid("7c95ec83-a399-4b47-b827-6d87795a7b19")},
                };
               
        UBIKContentClient target = new UBIKContentClient(WEBSERVER_NAME);
       
        BCDataShipment result = target.CreateSingleContentV212(
                                                                        appName,
                                                                        ctxName,
                                                                        ownerID,
                                                                        authToken,
                                                                        newContent,
                                                                        version);



Update Contents

Update Contents

Method for updating a set of content objects and retrieving the updated objects as result

        /// <summary>
        /// Member for updating a set of content objects and retrieving the updated objects as result
        /// </summary>
        /// <param name="appName">The name of the application</param>
        /// <param name="contextName">The name of the context the view hierarchy is defined in</param>
        /// <param name="authentication">The (valid) authentication token</param>
        /// <param name="dataShipment">Data container bringing all the necessary data for updating a set of content objects</param>
        /// <param name="version">Client Web Service Version number</param>
        /// <returns>a set of updated content objects as BCDataShipments</returns>
               
        [OperationContract]
        [WebInvoke(UriTemplate = "UpdateContentListV212/{appName}/{contextName}/{authentication}/{version}", Method = "POST",
                   RequestFormat = WebMessageFormat.Json,
                   BodyStyle = WebMessageBodyStyle.Bare,
                   ResponseFormat = WebMessageFormat.Json)]
                                   
        BCDataShipments UpdateContentListV212(string appName, string contextName, string authentication, UbikContent[] dataShipments, string version);

List of Parameters

Name Type Description
appName String Name of the Application
contextName String Name of the Context
authentication String Valid auth token
dataShipments UbikContent[] Content objects to be updated (MetaInformation and Property - Values)
version String Indicator of the expected data format version

HTTP (REST)

POST <CONTENT-PATH>/UBIKContent.svc/UpdateContentListV212/<APP>/<CTX>/<TOKEN>/<VERSION> HTTP/1.1
Host: <HOSTNAME/IP>:<PORT>
Content-Type: application/json
[
    {
        "__type": "UbikContent:#UBIK.Service.DTO.V260",
        "UID": "c02e668b-d400-41df-b7bc-ab3f1f31d250",
        "PropertyValues":              
        [
            {
                "__type": "TypePropertyValueOfstring:#UBIK.Service",
                "MetaPropertyID": "4ec5281a-e0bd-4917-aff5-708352fc6953",
                "ValidationTS":"/Date(1569942000000+0200)/",
                "Value": "TESTVALUE"
            },
            {
                "__type": "TypePropertyValueOfNullableOfint:#UBIK.Service",
                "MetaPropertyID": "7c95ec83-a399-4b47-b827-6d87795a7b19",
                "ValidationTS":"/Date(1569942000000+0200)/",
                "Value": 33
            }
        ]
    }
]

Make sure to replace the <tags> accordingly!

The __type property allows the JSON deserializer to find the correct class. [Microsoft Documentation].


Code Example (C#)

        string appName = "APP_TEST";
        string ctxName = "CTX_TEST";
        string authToken = FetchValidAuthToken();
        string version = "263";
       

        UbikContent updateContent = new UbikContent()
        {
                // reference to the MetaDefinition
                MetaClassID = new Guid("6b4bd904-8504-4e05-93dd-ae120d15a5be"),
                // update object => we must use the UID of an existing content object
                UID = new Guid("6b4bd904-8504-4e05-93dd-ae120d15a5be")
        };

        updateContent.PropertyValues = new UBIK.Service.PropertyValue[]
                {
                        new TypePropertyValue<string>()
                        {
                                // value to update
                                Value = "TESTVALUE",
                                // reference to the MetaProperty definition
                                MetaPropertyID = new Guid("4ec5281a-e0bd-4917-aff5-708352fc6953")},

                        new TypePropertyValue<int?>()
                        {
                                // value to update
                                Value = int.MaxValue,
                                // reference to the MetaProperty definition
                                MetaPropertyID = new Guid("7c95ec83-a399-4b47-b827-6d87795a7b19")},
                };
       
        UBIKContentClient target = new UBIKContentClient(WEBSERVER_NAME);
       
        BCDataShipment result = target.UpdateContentListV212(
                                                                        appName,
                                                                        ctxName,                                                                       
                                                                        authToken,
                                                                        new UbikContent[] { updateContent },
                                                                        version);


Upload Document

Upload Document

Method for updating a set of content objects and retrieving the updated objects as result

        /// <summary>
        /// Uploads a file to the Server.
        /// </summary>
        /// <param name="stream">The stream of the file.</param>
        /// <returns>The Content objet of the uploaded file</returns>
               
        [OperationContract]
        [WebInvoke(UriTemplate = "UploadFile", Method = "POST",
                   ResponseFormat = WebMessageFormat.Json)]
                                   
        BCDataShipment UploadFile(Stream stream);

List of Parameters

Name Type Description
appName String Name of the Application (must be specified in the header)
contextName String Name of the Context (must be specified in the header)
authentication String Valid auth token (must be specified in the header)
fileTypeValue String FileType of the uploaded file (must be specified in the header)
documentId String UID of the related Content Instance (must be specified in the header)
version String Indicator of the expected data format version (must be specified in the header)

Code Example (C#)

        string appName = "APP_TEST";
        string ctxName = "CTX_TEST";
        string authToken = FetchValidAuthToken();
        string version = "263";
       
        Guid documentId = new Guid("61ba9775-c724-40ca-b5e1-7119ab9ab553");
        string filePath = "any File Path hrere";
        string fileType = "*.xml";
       
        Stream stream = null;
        try
        {
                stream = new FileStream(filePath, FileMode.Open);
                using (OperationContextScope scope = new OperationContextScope(target.InnerChannel))
                {
                        HttpRequestMessageProperty headerProperty = new HttpRequestMessageProperty();
                        headerProperty.Headers.Add("appName", appName);
                        headerProperty.Headers.Add("contextName", ctxName);
                        headerProperty.Headers.Add("authentication", authToken);
                        headerProperty.Headers.Add("documentId", documentId.ToString());
                        headerProperty.Headers.Add("fileType", fileType);

                        OperationContext.Current.OutgoingMessageProperties.Add(HttpRequestMessageProperty.Name, headerProperty);
                       
                        UBIKContentClient target = new UBIKContentClient(WEBSERVER_NAME);
                        BCDataShipment result = target.UploadFile(stream);
                }
        }
        finally
        {
                if (stream != null)
                        stream.Close();
        }


Exclusive Access

CheckOut

Tries to get exclusive access to all provided contents.

        [OperationContract]
        [WebInvoke(UriTemplate = "CheckOut/{appName}/{contextName}/{authentication}/{version}", Method = "POST",
                   RequestFormat = WebMessageFormat.Json,
                   BodyStyle = WebMessageBodyStyle.Bare,
                   ResponseFormat = WebMessageFormat.Json)]

        BCDataShipments CheckOut(
                            string appName,
                            string contextName,
                            string authentication,
                            UbikContent[] contents,
                            string version);


List of Parameters

Name Type Description
appName String Name of the Application
contextName String Name of the Context
authentication String Valid auth token
contents UbikContent[] Content objects to be checked out
version String Indicator of the expected data format version


Code Example (C#)

        string appName = "APP_TEST";
        string contextName = "CTX_TEST";
        string authToken = FetchValidAuthToken();
        string version = "362";

        UbikContent content = new UbikContent()
        {
                // reference to the MetaDefinition
                MetaClassID = new Guid("6b4bd904-8504-4e05-93dd-ae120d15a5be"),
                //  object => we must use the UID of an existing content object
                UID = new Guid("6b4bd904-8504-4e05-93dd-ae120d15a5be")
        };

        UBIKContentClient target = new UBIKContentClient(WEBSERVER_NAME);
       
        BCDataShipments result = target.CheckOut(
                               appName,
                               contextName,
                               authToken,
                               new UbikContent[] { content },
                               version);

Release

Tries to release the exclusive access to all provided contents.

        [OperationContract]
        [WebInvoke(UriTemplate = "Release/{appName}/{contextName}/{authentication}/{version}", Method = "POST",
                   RequestFormat = WebMessageFormat.Json,
                   BodyStyle = WebMessageBodyStyle.Bare,
                   ResponseFormat = WebMessageFormat.Json)]

        BCDataShipments Release(
                            string appName,
                            string contextName,
                            string authentication,
                            UbikContent[] contents,
                            string version);


List of Parameters

Name Type Description
appName String Name of the Application
contextName String Name of the Context
authentication String Valid auth token
contents UbikContent[] Content objects to be checked out
version String Indicator of the expected data format version


Code Example (C#)

        string appName = "APP_TEST";
        string contextName = "CTX_TEST";
        string authToken = FetchValidAuthToken();
        string version = "362";

        UbikContent content = new UbikContent()
        {
                // reference to the MetaDefinition
                MetaClassID = new Guid("6b4bd904-8504-4e05-93dd-ae120d15a5be"),
                //  object => we must use the UID of an existing content object
                UID = new Guid("6b4bd904-8504-4e05-93dd-ae120d15a5be")
        };

        UBIKContentClient target = new UBIKContentClient(WEBSERVER_NAME);
       
        BCDataShipments result = target.Release(
                               appName,
                               contextName,
                               authToken,
                               new UbikContent[] { content },
                               version);