Jump to: navigation, search

Difference between revisions of "UBIK Graph Service"


(Created page with "The UBIK Graph Service is an Interface consisting of web service, based on .Net Core, and a Ubik Plugin. The Graph Service Client plugin manages the communication between the...")
 
(No difference)

Latest revision as of 15:23, 10 May 2021

The UBIK Graph Service is an Interface consisting of web service, based on .Net Core, and a Ubik Plugin. The Graph Service Client plugin manages the communication between the UBIK system and the Ubik Graph Service is responsible for the authentication and communication to the Microsoft Graph API. To get access to the Microsoft Graph API you must register a new App on your Microsoft Azure Portal (see: Additional Information).

Web Service

The Web Service exposes the following endpoints, to communicate to the Microsoft Graph API. The request must be formatted as JSON.

POST: https://<IIS host>/Authentication

Request Body
string clientId
string tenantId
string clientSecret
NetworkCredential networkCredential
GrantType grantType

GrantType
ClientCredentials: 0 UsernamePasswordCredentials: 1

Response

Data contains a Token property, where the generated token is stored.
Message Contains a GraphMessage, of the result of the request

POST: https://<IIS host>/SharePoint/File

Request
The authorization header must contain the token in <Bearer token> format

The request body must contan the following properties formatted as JSON.
string FilePath
string File
string Description
string SiteId
string DriveId

Response
The Response contains the GraphMessage Message GraphMessage property, which contains information about the request.

PUT: https://<IIS host>/SharePoint/File

Request
The authorization header must contain the token in <Bearer token> format

The request body must contan the following properties formatted as JSON.
string FilePath
string NewFilePath (optional)
string File (optional)
string Description (optional)
string SiteId
string DriveId

Response
The Response contains the GraphMessage Message property, which contains information about the request.

GraphMessage

The GraphMessage is part of every response and contains information about the request and has the following properties:
string Message
enum Status {Success: 0,Failed: 1, Unauthorized: 2}


UbikGraphClient Plugin

The Plugin provides a Class, which can be instantiated and handles the communication with the service. Depending on the Authentication Flow you can instantiate the client via several constructors. This plugin will then manage the Authorization to the service for the customizer.

Client Credentials Flow

public Client(string serviceUrl, string tenantId, string cleintId, string clientSecret)

Username/Password Flow

public Client(string serviceUrl, string tenantId, string cleintId, NetworkCredential networkCredential)

SharePoint

The Client class also provides methods to create and update files on SharePoint

 public GraphMessage CreateFile(string SiteId, string DriveId, string FilePath, string File, string Description)

The SiteId and DriveId are defined by the Sharepoint.
The FilePath is the Path of the file on the Sharepoint, including the file name and the file extension.
The File is the content of the file formatted as base64.
The Description is the Sharepints description and can be null.

public GraphMessage UpdateFile(string SiteId, string DriveId, string FilePath, string File, string Description, string NewFilePath)

The SiteId and DriveId are defined by Sharepoint.
The FilePath is the Path of the file on Sharepoint, including the file name and the file extension.
The File is the content of the file formatted as base64. (optional)
The Description is the Sharepints description. (optional)
The NewFilePath is the new file path on the SharePoint including the file name and the file extension. (optional)

Additional Information

App Registration
.Net Core on IIS