diff --git a/certified-connectors/Tribal - SITS/README.md b/certified-connectors/Tribal - SITS/README.md new file mode 100644 index 000000000..f0960b4a0 --- /dev/null +++ b/certified-connectors/Tribal - SITS/README.md @@ -0,0 +1,41 @@ +# Tribal - SITS +Streamline the day-to-day administration of student management to enhance student experience. + +## Publisher: Tribal +We provide the expertise, software and services required to underpin student success. + +## Prerequisites + +### Documentation +[EMEA Documentation](https://help.tribaledge.com/emea/edge/EdgeEducation.htm) +[APAC Documentation](https://help.tribaledge.com/apac/edge/EdgeEducation.htm) + +## Supported Operations +**Record** refers to one of the available business records in Tribal like such as Person, Schools, Desks, Applications etc. + +### Triggers +- `When an event happens`: Triggers anytime an event on an entity happens within Tribal SITS. + +### Actions +- `Create an entity`: Creates an entity within Tribal Maytas. +- `Read record`: Reads a record within Tribal SITS. +- `Read records`: Reads many records within Tribal SITS. +- `Update record`: Update a record in Tribal SITS. +- `Delete record`: Delete a record in Tribal SITS. +- `Send an HTTP request`: Performs a custom request on a relative path for Tribal SITS. + +## Obtaining Credentials +1. Sign in to create a connection using your Tribal account to define the following: +- Environment such as Live, Test or Development. +- Region such as APAC or EMEA. +- Edge Tenant ID as supplied by Tribal. + +2. On sign in, you must enable the following permissions: +- Events Connector Endpoint +- Connect to the web hooks + +## Known Issues and Limitations +None + +## Deployment instructions +Please use [these instructions](https://docs.microsoft.com/en-us/connectors/custom-connectors/paconn-cli) to deploy this connector as custom connector in Microsoft Power Automate and Power Apps \ No newline at end of file diff --git a/certified-connectors/Tribal - SITS/Script.cs b/certified-connectors/Tribal - SITS/Script.cs new file mode 100644 index 000000000..6b42523a4 --- /dev/null +++ b/certified-connectors/Tribal - SITS/Script.cs @@ -0,0 +1,322 @@ +using System; +using System.Net; +using System.Net.Http; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; + +/// +/// Power Automate connector script +/// +public class Script : ScriptBase +{ + /// + ///EqualsSeparator + /// + private static readonly char[] EqualsSeparator = new[] { '=' }; + private static readonly string SegmentPatternWithRecord = "Record"; + private static readonly string ServiceDomain = "siw_api/"; + public override async Task ExecuteAsync() + { + if (Context!.OperationId == "RawRequest") + { + return await HandleRawRequestAsync().ConfigureAwait(false); + } + + return await HandleNonRawRequestsAsync().ConfigureAwait(false); + } + + private async Task HandleRawRequestAsync() + { + var request = Context!.Request; + if(request?.Content == null) + { + return new HttpResponseMessage(HttpStatusCode.BadRequest) + { + Content = CreateJsonContent("Content not defined on request") + }; + } + var content = await request.Content.ReadAsStringAsync().ConfigureAwait(false); + + var obj = JObject.Parse(content); + var body = GetValue(obj, "body"); + + var verb = GetValue(obj, "verb"); + + var url = $"{request.RequestUri}{ServiceDomain}{GetValue(obj, "relativeUrl")?.TrimStart('/')}"; + + if (!Uri.TryCreate(url, UriKind.Absolute, out _)) + { + return new HttpResponseMessage(HttpStatusCode.BadRequest) + { + Content = CreateJsonContent($"Invalid Url Format '{url}'") + }; + } + + if (!string.IsNullOrEmpty(body)) + { + request.Content = CreateJsonContent(body); + } + + if (string.IsNullOrEmpty(verb)) + { + return new HttpResponseMessage(HttpStatusCode.BadRequest) + { + Content = CreateJsonContent("Verb must be provided.") + }; + } + + url = AppendQueryParamsRawRequest(url, obj); + + request.Method = new HttpMethod(verb); + request.RequestUri = new Uri(url); + + foreach (var token in GetValue(obj, "headers") ?? new JArray()) + { + var item = token.Value(); + + var key = GetValue(item, "headerKey"); + if (key == null) + { + return new HttpResponseMessage(HttpStatusCode.BadRequest) + { + Content = CreateJsonContent("Headers are invalid.") + }; + } + + var value = GetValue(item, "headerValue"); + // Need to to add without validation because the etag causes it to fail + request.Headers.TryAddWithoutValidation(key, value); + } + + return await Context.SendAsync(request, CancellationToken).ConfigureAwait(false); + } + + private static string AppendQueryParamsRawRequest(string url, JObject obj) + { + var tokens = GetValue(obj, "query") ?? new JArray(); + if(tokens.Count > 0) + { + url += "?"; + } + + foreach (var token in tokens) + { + var item = token.Value(); + + var key = GetValue(item, "queryKey"); + var value = GetValue(item, "queryValue"); + + if (!string.IsNullOrWhiteSpace(key) && !string.IsNullOrWhiteSpace(key)) + { + url += $"{key}={value}&"; + } + } + + if (url.EndsWith("&")) + { + url = url.TrimEnd('&'); + } + + if (url.EndsWith("?")) + { + url = url.TrimEnd('?'); + } + + return url; + } + + private async Task HandleNonRawRequestsAsync() + { + var request = Context?.Request; + if (request == null) + { + return new HttpResponseMessage(HttpStatusCode.BadRequest) + { + Content = CreateJsonContent("Request context is not available.") + }; + } + + var uri = request.RequestUri; + if (uri == null) + { + return new HttpResponseMessage(HttpStatusCode.BadRequest) + { + Content = CreateJsonContent("Request URI is not available.") + }; + } + + try + { + var queryParams = ExtractQueryParams(uri); + var verb = GetLastSegment(uri); + var route = DecodeQueryParam(queryParams, "route"); + var version = DecodeQueryParam(queryParams, "version"); + + var url = BuildUrl(uri, route); + + var content = await request.Content!.ReadAsStringAsync().ConfigureAwait(false); + var obj = JObject.Parse(content); + + url = ReplaceRouteValues(url, obj); + + url = AppendQueryParams(url, obj); + + AddHeadersToRequest(request, obj, version); + + request.RequestUri = new Uri(url); + request.Method = new HttpMethod(verb); + + var body = GetValue(obj, "body"); + + request.Content = CreateJsonContent(JsonConvert.SerializeObject(body)); + } + catch (InvalidOperationException ex) + { + return new HttpResponseMessage(HttpStatusCode.BadRequest) + { + Content = CreateJsonContent(ex.Message) + }; + } + + return await Context!.SendAsync(request, CancellationToken).ConfigureAwait(false); + } + + /// + /// ExtractQueryParams + /// + /// + /// + private static Dictionary ExtractQueryParams(Uri uri) + { + if (uri == null || string.IsNullOrEmpty(uri.Query)) + { + return new Dictionary(); + } + + return uri.Query.TrimStart('?') + .Split('&') + .Where(part => !string.IsNullOrEmpty(part) && part.Contains('=')) + .Select(part => part.Split(EqualsSeparator, 2)) + .ToDictionary( + part => part[0], + part => part.Length > 1 ? part[1] : string.Empty, + StringComparer.OrdinalIgnoreCase); + } + /// + /// GetLastSegment + /// + /// + /// + private static string GetLastSegment(Uri uri) + { + if (uri.Segments.Length == 0) + { + throw new InvalidOperationException("The URI does not contain any segments."); + } + string lastSegment = uri.Segments[uri.Segments.Length - 1]; + + if (lastSegment.Contains(SegmentPatternWithRecord)) + { + return lastSegment.Split(new[] { SegmentPatternWithRecord }, StringSplitOptions.None)[0]; + } + + throw new InvalidOperationException("The last segment does not match the expected pattern."); + } + /// + /// DecodeQueryParam + /// + /// + /// + /// + private static string DecodeQueryParam(Dictionary? queryParams, string key) + { + return HttpUtility.UrlDecode(queryParams?[key])!; + } + /// + /// BuildUrl + /// + /// + /// + /// + private static string BuildUrl(Uri uri, string route) + { + if (uri.Segments.Length == 0) + { + throw new InvalidOperationException("The URI does not contain any segments."); + } + string lastSegment = uri.Segments[uri.Segments.Length - 1]; + return uri.ToString() + .Replace(lastSegment, ServiceDomain + route?.TrimStart('/')) + .Split('?')[0]; + } + /// + /// ReplaceRouteValues + /// + /// + /// + /// + private static string ReplaceRouteValues(string part, JObject obj) + { + part = HttpUtility.UrlDecode(part); + + var routeValues = GetValue(obj, "Path") ?? new JObject(); + + foreach (var routeValue in routeValues) + { + part = part.Replace($"{{{routeValue.Key}}}", routeValue.Value?.ToString()); + } + return part; + } + + /// + /// AppendQueryParams + /// + /// + /// + /// + private static string AppendQueryParams(string part, JObject obj) + { + part += "?"; + var queries = GetValue(obj, "Query") ?? new JObject(); + foreach (var query in queries) + { + part += $"{query.Key}={query.Value}&"; + } + + if (part.EndsWith("&")) + { + part = part.TrimEnd('&'); + } + + return part; + } + + /// + /// AddHeadersToRequest + /// + /// Request + /// Body + /// Version + private static void AddHeadersToRequest(HttpRequestMessage request, JObject obj, string version) + { + var headers = GetValue(obj, "Header") ?? new JObject(); + foreach (var header in headers) + { + var value = header.Value?.Value() ?? string.Empty; + request.Headers.TryAddWithoutValidation(header.Key, value); + } + request.Headers.TryAddWithoutValidation("version", version); + } + /// + /// GetValue + /// + /// + /// + /// + /// + private static T? GetValue(JObject? obj, string key) where T : class + { + return obj?.GetValue(key, StringComparison.InvariantCulture)?.Value(); + } + +} diff --git a/certified-connectors/Tribal - SITS/apiDefinition.swagger.json b/certified-connectors/Tribal - SITS/apiDefinition.swagger.json new file mode 100644 index 000000000..d151b19ae --- /dev/null +++ b/certified-connectors/Tribal - SITS/apiDefinition.swagger.json @@ -0,0 +1,1552 @@ +{ + "swagger": "2.0", + "info": { + "title": "Tribal - SITS", + "description": "Streamline the day-to-day administration of student management to enhance student experience", + "version": "0.1", + "contact": { + "name": "Tribal Group", + "url": "https://www.tribalgroup.com", + "email": "servicedesk@tribalgroup.com" + } + }, + "x-ms-connector-metadata": [ + { + "propertyName": "Website", + "propertyValue": "https://www.tribalgroup.com" + }, + { + "propertyName": "Privacy policy", + "propertyValue": "https://www.tribalgroup.com/privacy-policy" + }, + { + "propertyName": "Categories", + "propertyValue": "Business Management" + } + ], + "host": "k8s-label.edge.tribaldev.net", + "basePath": "/dev/", + "schemes": [ "https" ], + "consumes": [], + "produces": [], + "paths": { + "/eventsConnector/api/Events/entityTypes/SITSGateway": { + "get": { + "summary": "Get Triggers", + "description": "Get Triggers", + "operationId": "GetTriggers", + "x-ms-visibility": "internal", + "parameters": [], + "responses": { + "200": { + "description": "Success", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/DynamicValue" + } + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + }, + "403": { + "description": "Forbidden", + "schema": { + "$ref": "#/definitions/ForbiddenResponse" + } + } + } + } + }, + "/eventsConnector/api/Events/eventTypes/SITSGateway/{name}": { + "get": { + "summary": "Get Trigger Event Types", + "operationId": "GetTriggerEventTypes", + "description": "Get Trigger Event Types", + "x-ms-visibility": "internal", + "parameters": [ + { + "name": "name", + "in": "path", + "x-ms-url-encoding": "single", + "required": true, + "type": "string", + "x-ms-visibility": "important", + "x-ms-dynamic-values": { + "operationId": "GetTriggers", + "value-path": "name", + "value-title": "description" + } + } + ], + "responses": { + "default": { + "description": "default", + "schema": {} + } + } + } + }, + "/eventsConnector/api/Events/eventSchema/SITSGateway/{eventType}/{name}": { + "get": { + "x-ms-visibility": "internal", + "description": "Gets the triggers schema", + "summary": "Gets the triggers schema", + "operationId": "GetTriggerSchema", + "parameters": [ + { + "name": "name", + "x-ms-summary": "The name", + "description": "The name", + "x-ms-url-encoding": "single", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "eventType", + "x-ms-summary": "The name of the event type", + "description": "The name of the event type", + "x-ms-url-encoding": "single", + "in": "path", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "Success", + "schema": { + "type": "object" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + }, + "403": { + "description": "Forbidden", + "schema": { + "$ref": "#/definitions/ForbiddenResponse" + } + }, + "404": { + "description": "Not Found", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + } + } + } + }, + "/eventsConnector/api/WebHook/SITSGateway/{eventType}/{name}": { + "x-ms-notification-content": { + "description": "When an event happens", + "x-ms-summary": "When an event happens", + "schema": { + "type": "object", + "properties": { + "data": { + "type": "object", + "x-ms-dynamic-schema": { + "operationId": "GetTriggerSchema", + "parameters": { + "name": { + "parameter": "name" + }, + "eventType": { + "parameter": "eventType" + } + } + }, + "x-ms-dynamic-properties": { + "operationId": "GetTriggerSchema", + "parameters": { + "name": { + "parameterReference": "name" + }, + "eventType": { + "parameterReference": "eventType" + } + } + } + }, + "id": { + "type": "string" + }, + "source": { + "type": "string" + }, + "type": { + "type": "string" + }, + "time": { + "format": "date-time", + "type": "string" + }, + "dataSchema": { + "type": "string" + }, + "dataContentType": { + "type": "string" + }, + "extensionAttributes": { + "type": "object", + "additionalProperties": { + "type": "object" + } + } + } + } + }, + "post": { + "responses": { + "201": { + "description": "Success", + "schema": { + "$ref": "#/definitions/TriggerCreateSuccess" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + }, + "403": { + "description": "Forbidden", + "schema": { + "$ref": "#/definitions/ForbiddenResponse" + } + } + }, + "summary": "When an event happens", + "description": "This operation triggers when a specified event happens", + "operationId": "WhenEventHappens", + "x-ms-visibility": "important", + "x-ms-trigger": "single", + "parameters": [ + { + "name": "name", + "x-ms-summary": "Name", + "description": "The name of the event", + "x-ms-url-encoding": "single", + "in": "path", + "required": true, + "type": "string", + "x-ms-dynamic-values": { + "operationId": "GetTriggers", + "value-path": "name", + "value-title": "description" + } + }, + { + "name": "eventType", + "in": "path", + "x-ms-url-encoding": "single", + "x-ms-summary": "Event Type", + "description": "The type of event e.g. Updated or Created", + "required": true, + "type": "string", + "x-ms-dynamic-values": { + "operationId": "GetTriggerEventTypes", + "value-path": "name", + "value-title": "description", + "parameters": { + "name": { + "parameter": "name" + } + } + } + }, + { + "name": "body", + "in": "body", + "required": false, + "schema": { + "type": "object", + "properties": { + "targetUri": { + "type": "string", + "description": "targetUri", + "x-ms-notification-url": true, + "x-ms-visibility": "internal", + "title": "" + } + }, + "required": [ "targetUri" ] + } + } + ] + } + }, + "/sitsgateway/api/connector/operations/{operationType}": { + "get": { + "responses": { + "200": { + "description": "Success", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/DynamicValue" + } + } + } + }, + "operationId": "GetOperationsForVerb", + "summary": "Get Operations", + "description": "Get operations for a specific verb", + "parameters": [ + { + "name": "operationType", + "in": "path", + "required": true, + "type": "string", + "default": "get", + "x-ms-visibility": "internal", + "enum": [ "get", "put", "post", "delete" ] + }, + { + "name": "version", + "in": "query", + "required": true, + "type": "string", + "default": "10.8 Initial Release", + "x-ms-visibility": "internal" + } + ], + "x-ms-visibility": "internal" + } + }, + "/sitsgateway/api/connector/versions": { + "get": { + "responses": { + "200": { + "description": "Success", + "schema": { + "$ref": "#/definitions/DynamicValue" + } + } + }, + "operationId": "GetVersions", + "summary": "Get Versions", + "description": "Get versions for a specific verb", + "parameters": [ + { + "name": "operationType", + "in": "query", + "required": false, + "type": "string", + "x-ms-visibility": "internal", + "enum": [ "get", "put", "post", "delete" ] + } + ], + "x-ms-visibility": "internal" + } + }, + "/sitsgateway/api/connector/operations/{operationType}/single": { + "get": { + "responses": { + "200": { + "description": "Success", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/DynamicValue" + } + } + } + }, + "operationId": "GetSingularOperationsForVerb", + "summary": "Get Singular Operations", + "description": "Get singular operations for a specific verb", + "parameters": [ + { + "name": "operationType", + "in": "path", + "required": true, + "type": "string", + "default": "get", + "x-ms-visibility": "internal", + "enum": [ "get" ] + }, + { + "name": "version", + "in": "query", + "required": true, + "type": "string", + "default": "10.8 Initial Release", + "x-ms-visibility": "internal" + } + ], + "x-ms-visibility": "internal" + } + }, + "/sitsgateway/api/connector/operations/{operationType}/multiple": { + "get": { + "responses": { + "200": { + "description": "Success", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/DynamicValue" + } + } + } + }, + "operationId": "GetMultipleOperationsForVerb", + "summary": "Get Multiple Operations", + "description": "Get multiple operations for a specific verb", + "parameters": [ + { + "name": "operationType", + "in": "path", + "required": true, + "type": "string", + "default": "get", + "x-ms-visibility": "internal", + "enum": [ "get" ] + }, + { + "name": "version", + "in": "query", + "required": true, + "type": "string", + "default": "10.8 Initial Release", + "x-ms-visibility": "internal" + } + ], + "x-ms-visibility": "internal" + } + }, + "/sitsgateway/api/connector/operations/{operationType}/schema/{type}": { + "get": { + "responses": { + "200": { + "description": "Success", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/DynamicValue" + } + } + } + }, + "operationId": "GetSchemaForRoute", + "summary": "Get Parameters", + "description": "Get parameters for route", + "x-ms-visibility": "internal", + "parameters": [ + { + "name": "operationType", + "in": "path", + "required": true, + "type": "string", + "default": "get", + "enum": [ "get", "put", "post", "delete" ], + "x-ms-visibility": "internal" + }, + { + "name": "type", + "in": "path", + "required": true, + "type": "string", + "default": "url", + "enum": [ "url", "response", "body" ], + "x-ms-visibility": "internal" + }, + { + "name": "route", + "in": "query", + "required": true, + "type": "string", + "default": "/", + "x-ms-visibility": "internal" + }, + { + "name": "version", + "in": "query", + "required": true, + "type": "string", + "default": "10.8 Initial Release", + "x-ms-visibility": "internal" + } + ] + } + }, + "/sitsgateway/getRecord": { + "post": { + "responses": { + "200": { + "description": "Success", + "schema": { + "type": "object", + "x-ms-dynamic-schema": { + "operationId": "GetSchemaForRoute", + "parameters": { + "route": { + "parameter": "route" + }, + "version": { + "parameter": "version" + }, + "type": "response", + "operationType": "get" + }, + "value-path": "properties" + }, + "x-ms-dynamic-properties": { + "operationId": "GetSchemaForRoute", + "parameters": { + "route": { + "parameterReference": "route" + }, + "version": { + "parameterReference": "version" + }, + "type": { "value": "response" }, + "operationType": { "value": "get" } + } + } + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/TRB_400_1" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/TRB_401_1" + } + }, + "403": { + "description": "Forbidden", + "schema": { + "$ref": "#/definitions/TRB_403_1" + } + }, + "404": { + "description": "Not Found", + "schema": { + "$ref": "#/definitions/TRB_404_1" + } + } + }, + "operationId": "ReadRecord", + "summary": "Read record", + "description": "Read record", + "parameters": [ + { + "name": "version", + "in": "query", + "type": "string", + "x-ms-summary": "Version", + "description": "Version", + "x-ms-dynamic-values": { + "operationId": "GetVersions", + "value-path": "name", + "value-title": "description", + "parameters": { + "operationType": "get" + } + }, + + "required": true + }, + { + "name": "route", + "in": "query", + "type": "string", + "x-ms-summary": "Operation", + "description": "Operation to perform", + "x-ms-dynamic-values": { + "operationId": "GetSingularOperationsForVerb", + "value-path": "name", + "value-title": "description", + "parameters": { + "operationType": "get", + "version": { + "parameter": "version" + } + } + }, + + "required": true + }, + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "type": "object", + "x-ms-dynamic-schema": { + "operationId": "GetSchemaForRoute", + "parameters": { + "route": { + "parameter": "route" + }, + "version": { + "parameter": "version" + }, + "type": "url", + "operationType": "get" + }, + "value-path": "properties" + }, + "x-ms-dynamic-properties": { + "operationId": "GetSchemaForRoute", + "parameters": { + "route": { + "parameterReference": "route" + }, + "version": { + "parameterReference": "version" + }, + "type": { "value": "url" }, + "operationType": { "value": "get" } + } + }, + "x-ms-visibility": "important" + } + } + ] + + } + + }, + "/sitsgateway/getRecords": { + "post": { + "responses": { + "200": { + "description": "Success", + "schema": { + "type": "object", + "x-ms-dynamic-schema": { + "operationId": "GetSchemaForRoute", + "parameters": { + "route": { + "parameter": "route" + }, + "version": { + "parameter": "version" + }, + "type": "response", + "operationType": "get" + }, + "value-path": "properties" + }, + "x-ms-dynamic-properties": { + "operationId": "GetSchemaForRoute", + "parameters": { + "route": { + "parameterReference": "route" + }, + "version": { + "parameterReference": "version" + }, + "type": { "value": "response" }, + "operationType": { "value": "get" } + } + } + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/TRB_400_1" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/TRB_401_1" + } + }, + "403": { + "description": "Forbidden", + "schema": { + "$ref": "#/definitions/TRB_403_1" + } + }, + "404": { + "description": "Not Found", + "schema": { + "$ref": "#/definitions/TRB_404_1" + } + } + }, + "operationId": "ReadRecords", + "summary": "Read records", + "description": "Read records", + "parameters": [ + { + "name": "version", + "in": "query", + "type": "string", + "x-ms-summary": "Version", + "description": "Version", + "x-ms-dynamic-values": { + "operationId": "GetVersions", + "value-path": "name", + "value-title": "description", + "parameters": { + "operationType": "get" + } + }, + "required": true + }, + { + "name": "route", + "in": "query", + "type": "string", + "x-ms-summary": "Operation", + "description": "Operation to perform", + "x-ms-dynamic-values": { + "operationId": "GetMultipleOperationsForVerb", + "value-path": "name", + "value-title": "description", + "parameters": { + "operationType": "get", + "version": { + "parameter": "version" + } + } + }, + "required": true + }, + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "type": "object", + "x-ms-dynamic-schema": { + "operationId": "GetSchemaForRoute", + "parameters": { + "route": { + "parameter": "route" + }, + "version": { + "parameter": "version" + }, + "type": "url", + "operationType": "get" + }, + "value-path": "properties" + }, + "x-ms-dynamic-properties": { + "operationId": "GetSchemaForRoute", + "parameters": { + "route": { + "parameterReference": "route" + }, + "version": { + "parameterReference": "version" + }, + "type": { "value": "url" }, + "operationType": { "value": "get" } + } + }, + "x-ms-visibility": "important" + } + } + ] + + } + }, + "/sitsgateway/putRecords": { + "put": { + "responses": { + "200": { + "description": "Success", + "schema": { + "type": "object", + "x-ms-dynamic-schema": { + "operationId": "GetSchemaForRoute", + "parameters": { + "route": { + "parameter": "route" + }, + "version": { + "parameter": "version" + }, + "type": "response", + "operationType": "put" + }, + "value-path": "properties" + }, + "x-ms-dynamic-properties": { + "operationId": "GetSchemaForRoute", + "parameters": { + "route": { + "parameterReference": "route" + }, + "version": { + "parameterReference": "version" + }, + "type": { "value": "response" }, + "operationType": { "value": "put" } + } + } + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/TRB_400_1" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/TRB_401_1" + } + }, + "403": { + "description": "Forbidden", + "schema": { + "$ref": "#/definitions/TRB_403_1" + } + }, + "404": { + "description": "Not Found", + "schema": { + "$ref": "#/definitions/TRB_404_1" + } + } + }, + "operationId": "UpdateRecord", + "summary": "Update record", + "description": "Update record", + "parameters": [ + { + "name": "version", + "in": "query", + "type": "string", + "x-ms-summary": "Version", + "description": "Version", + "x-ms-dynamic-values": { + "operationId": "GetVersions", + "value-path": "name", + "value-title": "description", + "parameters": { + "operationType": "put" + } + }, + "required": true + }, + { + "name": "route", + "in": "query", + "type": "string", + "x-ms-summary": "Operation", + "description": "Operation to perform", + "x-ms-dynamic-values": { + "operationId": "GetOperationsForVerb", + "value-path": "name", + "value-title": "description", + "parameters": { + "operationType": "put", + "version": { + "parameter": "version" + } + } + }, + "required": true + }, + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "type": "object", + "x-ms-dynamic-schema": { + "operationId": "GetSchemaForRoute", + "parameters": { + "route": { + "parameter": "route" + }, + "version": { + "parameter": "version" + }, + "type": "body", + "operationType": "put" + }, + "value-path": "properties" + }, + "x-ms-dynamic-properties": { + "operationId": "GetSchemaForRoute", + "parameters": { + "route": { + "parameterReference": "route" + }, + "version": { + "parameterReference": "version" + }, + "type": { "value": "body" }, + "operationType": { "value": "put" } + } + }, + "x-ms-visibility": "important" + } + } + ] + } + }, + "/sitsgateway/postRecord": { + "post": { + "responses": { + "200": { + "description": "Success", + "schema": { + "type": "object", + "x-ms-dynamic-schema": { + "operationId": "GetSchemaForRoute", + "parameters": { + "route": { + "parameter": "route" + }, + "version": { + "parameter": "version" + }, + "type": "response", + "operationType": "post" + }, + "value-path": "properties" + }, + "x-ms-dynamic-properties": { + "operationId": "GetSchemaForRoute", + "parameters": { + "route": { + "parameterReference": "route" + }, + "version": { + "parameterReference": "version" + }, + "type": { "value": "response" }, + "operationType": { "value": "post" } + } + } + } + }, + "201": { + "description": "Created", + "schema": { + "type": "object", + "x-ms-dynamic-schema": { + "operationId": "GetSchemaForRoute", + "parameters": { + "route": { + "parameter": "route" + }, + "version": { + "parameter": "version" + }, + "type": "response", + "operationType": "post" + }, + "value-path": "properties" + }, + "x-ms-dynamic-properties": { + "operationId": "GetSchemaForRoute", + "parameters": { + "route": { + "parameterReference": "route" + }, + "version": { + "parameterReference": "version" + }, + "type": { "value": "response" }, + "operationType": { "value": "post" } + } + } + } + }, + "204": { + "description": "No Content" + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/TRB_400_1" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/TRB_401_1" + } + }, + "403": { + "description": "Forbidden", + "schema": { + "$ref": "#/definitions/TRB_403_1" + } + }, + "404": { + "description": "Not Found", + "schema": { + "$ref": "#/definitions/TRB_404_1" + } + } + }, + "operationId": "CreateRecord", + "summary": "Create record", + "description": "Create record", + "parameters": [ + { + "name": "version", + "in": "query", + "type": "string", + "x-ms-summary": "Version", + "description": "Version", + "required": true, + "x-ms-dynamic-values": { + "operationId": "GetVersions", + "value-path": "name", + "value-title": "description", + "parameters": { + "operationType": "post" + } + } + }, + { + "name": "route", + "in": "query", + "type": "string", + "x-ms-summary": "Operation", + "description": "Operation to perform", + "required": true, + "x-ms-dynamic-values": { + "operationId": "GetOperationsForVerb", + "value-path": "name", + "value-title": "description", + "parameters": { + "operationType": "post", + "version": { + "parameter": "version" + } + } + } + }, + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "type": "object", + "x-ms-dynamic-schema": { + "operationId": "GetSchemaForRoute", + "parameters": { + "route": { + "parameter": "route" + }, + "version": { + "parameter": "version" + }, + "type": "body", + "operationType": "post" + } + }, + "x-ms-dynamic-properties": { + "operationId": "GetSchemaForRoute", + "parameters": { + "route": { + "parameterReference": "route" + }, + "version": { + "parameterReference": "version" + }, + "type": { "value": "body" }, + "operationType": { "value": "post" } + } + }, + "x-ms-visibility": "important" + } + } + ] + } + }, + "/sitsgateway/deleteRecord": { + "post": { + "responses": { + "200": { + "description": "Success", + "schema": { + "type": "object", + "x-ms-dynamic-schema": { + "operationId": "GetSchemaForRoute", + "parameters": { + "route": { + "parameter": "route" + }, + "version": { + "parameter": "version" + }, + "type": "response", + "operationType": "delete" + }, + "value-path": "properties" + }, + "x-ms-dynamic-properties": { + "operationId": "GetSchemaForRoute", + "parameters": { + "route": { + "parameterReference": "route" + }, + "version": { + "parameterReference": "version" + }, + "type": { "value": "response" }, + "operationType": { "value": "delete" } + } + } + } + + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/TRB_400_1" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/TRB_401_1" + } + }, + "403": { + "description": "Forbidden", + "schema": { + "$ref": "#/definitions/TRB_403_1" + } + }, + "404": { + "description": "Not Found", + "schema": { + "$ref": "#/definitions/TRB_404_1" + } + } + }, + "operationId": "DeleteRecord", + "summary": "Delete record", + "description": "Delete record", + "parameters": [ + { + "name": "version", + "in": "query", + "type": "string", + "x-ms-summary": "Version", + "description": "Version", + "x-ms-dynamic-values": { + "operationId": "GetVersions", + "value-path": "name", + "value-title": "description", + "parameters": { + "operationType": "delete" + } + }, + "required": true + }, + { + "name": "route", + "in": "query", + "type": "string", + "x-ms-summary": "Operation", + "description": "Operation to perform", + "x-ms-dynamic-values": { + "operationId": "GetOperationsForVerb", + "value-path": "name", + "value-title": "description", + "parameters": { + "operationType": "delete", + "version": { + "parameter": "version" + } + } + + }, + "required": true + }, + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "type": "object", + "x-ms-dynamic-schema": { + "operationId": "GetSchemaForRoute", + "parameters": { + "route": { + "parameter": "route" + }, + "version": { + "parameter": "version" + }, + "type": "url", + "operationType": "delete" + }, + "value-path": "properties" + }, + "x-ms-dynamic-properties": { + "operationId": "GetSchemaForRoute", + "parameters": { + "route": { + "parameterReference": "route" + }, + "version": { + "parameterReference": "version" + }, + "type": { "value": "url" }, + "operationType": { "value": "delete" } + } + }, + "x-ms-visibility": "important" + } + } + ] + } + }, + "/sitsgateway/": { + "post": { + "responses": { + "200": { + "description": "Success" + }, + "201": { + "description": "Created" + }, + "204": { + "description": "No Content" + }, + "400": { + "description": "Bad Request" + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + }, + "403": { + "description": "Forbidden", + "schema": { + "$ref": "#/definitions/ForbiddenResponse" + } + }, + "404": { + "description": "Not Found" + } + }, + "summary": "Send an HTTP request", + "description": "Send an HTTP request to SITS", + "operationId": "RawRequest", + "x-ms-visibility": "important", + "parameters": [ + { + "name": "body", + "in": "body", + "required": false, + "schema": { + "type": "object", + "properties": { + "verb": { + "type": "string", + "description": "HTTP Verb", + "x-ms-summary": "Verb", + "x-ms-visibility": "important", + "enum": [ "GET", "POST", "PUT", "PATCH", "DELETE" ] + }, + "relativeUrl": { + "type": "string", + "description": "Relative URL", + "x-ms-summary": "Relative URL e.g. /documents/adocumentcode", + "x-ms-visibility": "important" + }, + "query": { + "type": "array", + "items": { + "type": "object", + "properties": { + "queryKey": { + "type": "string", + "description": "Query key", + "x-ms-summary": "Query Key" + }, + "queryValue": { + "type": "string", + "description": "Query value", + "x-ms-summary": "Query Value" + } + } + }, + "description": "Additional query string", + "x-ms-summary": "Query string", + "x-ms-visibility": "important" + }, + "body": { + "type": "string", + "description": "Body of the request", + "x-ms-summary": "Body", + "x-ms-visibility": "important" + }, + "headers": { + "type": "array", + "items": { + "type": "object", + "properties": { + "headerKey": { + "type": "string", + "description": "Key", + "x-ms-summary": "Header Key" + }, + "headerValue": { + "type": "string", + "description": "Value", + "x-ms-summary": "Header Value" + } + }, + "required": [ "headerKey", "headerValue" ] + }, + "description": "Any additional headers", + "x-ms-summary": "Headers", + "x-ms-visibility": "important" + } + }, + "required": [ "verb", "relativeUrl", "headers" ] + } + } + ] + } + } + }, + "definitions": { + "Action": { + "type": "object", + "properties": { + "operationType": { + "type": "string", + "description": "verb" + }, + "body": { + "type": "string", + "description": "body" + }, + "routeParams": { + "type": "array", + "items": { + "type": "object", + "properties": { + "key": { + "type": "string", + "description": "route" + }, + "value": { + "type": "string", + "description": "id" + } + } + }, + "description": "route parameters" + }, + "queryParams": { + "type": "array", + "items": { + "type": "object", + "properties": { + "key": { + "type": "string", + "description": "key" + }, + "value": { + "type": "string", + "description": "value" + } + } + }, + "description": "query parameters" + } + }, + "additionalProperties": false + }, + "DynamicValue": { + "type": "object", + "required": [ "name", "description" ], + "properties": { + "name": { + "type": "string" + }, + "description": { + "type": "string" + } + }, + "additionalProperties": false + }, + "ErrorResponse": { + "type": "object", + "required": [ "codeName", "message" ], + "properties": { + "codeName": { + "type": "string" + }, + "message": { + "type": "string" + } + } + }, + "ForbiddenResponse": { + "type": "array", + "items": { + "type": "string" + } + }, + "TriggerCreateSuccess": { + "type": "object", + "required": [ "targetUri" ], + "properties": { + "targetUri": { + "type": "string" + } + } + }, + "TRB_400_VE_1": { + "type": "object", + "properties": { + "key": { + "description": "The key highlights the part of the request with the issue", + "type": "string" + }, + "messages": { + "description": "The messages detailing the issue with the request", + "type": "string" + } + } + }, + "TRB_400_1": { + "type": "object", + "properties": { + "code": { + "description": "HTTP response code", + "type": "integer" + }, + "codeName": { + "description": "HTTP response code name", + "type": "string" + }, + "severity": { + "description": "The severity type of the error", + "type": "string" + }, + "type": { + "description": "The error type", + "type": "string" + }, + "message": { + "description": "The error message", + "type": "string" + }, + "validationErrors": { + "description": "An array of objects that hold issues with the request", + "type": "array", + "items": { + "$ref": "#/definitions/TRB_400_VE_1" + } + } + } + }, + "TRB_401_1": { + "type": "object", + "properties": { + "code": { + "description": "HTTP response code", + "type": "integer" + }, + "codeName": { + "description": "HTTP response code name", + "type": "string" + }, + "severity": { + "description": "The severity type of the error", + "type": "string" + }, + "type": { + "description": "The error type", + "type": "string" + }, + "message": { + "description": "The error message", + "type": "string" + } + } + }, + "TRB_403_1": { + "type": "object", + "properties": { + "code": { + "description": "HTTP response code", + "type": "integer" + }, + "codeName": { + "description": "HTTP response code name", + "type": "string" + }, + "severity": { + "description": "The severity type of the error", + "type": "string" + }, + "type": { + "description": "The error type", + "type": "string" + }, + "message": { + "description": "The error message", + "type": "string" + } + } + }, + "TRB_404_1": { + "type": "object", + "properties": { + "code": { + "description": "HTTP response code", + "type": "integer" + }, + "codeName": { + "description": "HTTP response code name", + "type": "string" + }, + "severity": { + "description": "The severity type of the error", + "type": "string" + }, + "type": { + "description": "The error type", + "type": "string" + }, + "message": { + "description": "The error message", + "type": "string" + } + } + } + }, + "tags": [], + "securityDefinitions": {} +} diff --git a/certified-connectors/Tribal - SITS/apiProperties.json b/certified-connectors/Tribal - SITS/apiProperties.json new file mode 100644 index 000000000..ce60a8d7f --- /dev/null +++ b/certified-connectors/Tribal - SITS/apiProperties.json @@ -0,0 +1,132 @@ +{ + "properties": { + "connectionParameters": { + "token": { + "type": "oauthSetting", + "oAuthSettings": { + "identityProvider": "oauth2generic", + "clientId": "[Dummy]", + "scopes": [ + "SITS.UI", + "sits.documents.api.read", + "sits.documents.api.write", + "sits.finance.api.write", + "sits.referencedata.api.read", + "sits.students.api.read", + "sits.students.api.write", + "sits.students.sensitivecharacteristics.api.read", + "SITSGateway.Connector.MetaData", + "web_hooks", + "edge", + "openid", + "edge_identity", + "offline_access" + ], + "redirectMode": "Global", + "redirectUrl": "https://global.consent.azure-apim.net/redirect", + "properties": { + "IsFirstParty": "False", + "IsOnbehalfofLoginSupported": false + }, + "customParameters": { + "authorizationUrlTemplate": { + "value": "https://identity{environment}/{region}/ids/{tenantId}/connect/authorize" + }, + "tokenUrlTemplate": { + "value": "https://identity{environment}/{region}/ids/{tenantId}/connect/token" + }, + "refreshUrlTemplate": { + "value": "https://identity{environment}/{region}/ids/{tenantId}/connect/token" + } + } + } + }, + "token:environment": { + "type": "string", + "uiDefinition": { + "constraints": { + "tabIndex": 0, + "required": "true", + "allowedValues": [ + { + "text": "Live", + "value": ".tribaledge.com" + }, + { + "text": "Development", + "value": "-master.edge.tribaldev.net" + } + ] + }, + "description": "Environment", + "displayName": "Environment", + "tooltip": "Environment" + } + }, + "token:region": { + "type": "string", + "uiDefinition": { + "constraints": { + "tabIndex": 0, + "required": "true", + "allowedValues": [ + { + "text": "Emea", + "value": "emea" + }, + { + "text": "Apac", + "value": "apac" + } + ] + }, + "description": "Region", + "displayName": "Region", + "tooltip": "Region" + } + }, + "token:tenantId": { + "type": "string", + "uiDefinition": { + "constraints": { + "tabIndex": 2, + "required": "true" + }, + "description": "Tenant Id for Tribal Edge", + "displayName": "Edge Tenant Id", + "tooltip": "Tenant Id for Tribal Edge" + } + } + }, + "iconBrandColor": "#0077C4", + "scriptOperations": [ + "ReadRecord", + "ReadRecords", + "DeleteRecord", + "CreateRecord", + "UpdateRecord", + "RawRequest" + ], + "capabilities": [], + "policyTemplateInstances": [ + { + "templateId": "dynamichosturl", + "title": "Host URL", + "parameters": { + "x-ms-apimTemplateParameter.urlTemplate": "https://api@connectionParameters('token:environment')/@connectionParameters('token:region')/" + } + }, + { + "templateId": "setheader", + "title": "Tenant Header", + "parameters": { + "x-ms-apimTemplateParameter.name": "tenantId", + "x-ms-apimTemplateParameter.value": "@connectionParameters('token:tenantId')", + "x-ms-apimTemplateParameter.existsAction": "override", + "x-ms-apimTemplate-policySection": "Request" + } + } + ], + "publisher": "Tribal Education Ltd." + } +}