Utility-methods

Method: Add external identity mapping

POST api/publicapi/AddExternalIdentityMapping

{

                "providerId": "oid:nilexoid",

                "providerSubjectId": "dzenan@nilex",

                "providerClaim": "userPrincipalName",

                "nspUserEmail":"sadmin@nilex.se"

}

Using this method in API you will have possibility to insert automatic mapping of NSP account to external account in your identity like ADFS, Office365, etc, using different providers WsFederation, SAML or OpenId. Without mapping first time when user log in to NSP, NSP will open page to register new NSP account or map to existing. Using this API method you can add predefined mapping.

ProviderId – is field you can find in external identity provider in NSP application when you add the provider.

ProviderSubjectId – is value the identity server will send to NSP.

ProviderClaim – is field containing value for ProviderSubjectID for example userPrincipalName, Email or other unique value.

NspUserEmail – is email for existing user in NSP, new mapping will be added to this account.

Method: Get entity type list

GET api/publicapi/getallentitytypes

Will return a list of all entity types. If you want to find out which fields exist on an entity type, use next method:

Method: Get entity type metadata

In order to find out which fields exist on an entity, call this method with entity name as parameter:

GET api/publicapi/getentitytypeinfo?entityType=Ticket

 

Response json for entity type “Ticket” – some fields have been removed for brevity:

{

  "Data": {

    "Namespace": "dbo",

    "Id": 112,

    "Name": "Ticket",

    "DisplayName": "IT Request",

    "Columns": [

    {

      "Id": 1,

      "Name": "Type",

      "DisplayName": "Type",

      "DataType": "int",

      "ReferenceType": "SysTable",

      "IsReference": true,

      "MaxLength": null

    },

    {

      "Id": 3,

      "Name": "Version",

      "DisplayName": "Version",

      "DataType": "int",

      "ReferenceType": null,

      "IsReference": false,

      "MaxLength": null

    },

    {

      "Id": 865,

      "Name": "CreatedDate",

      "DisplayName": "Created Date",

      "DataType": "datetime",

      "ReferenceType": null,

      "IsReference": false,

      "MaxLength": null

    },

    {

      "Id": 1249,

      "Name": "Priority",

      "DisplayName": "Priority",

      "DataType": "int",

      "ReferenceType": "SysPriority",

      "IsReference": true,

      "MaxLength": null

    },

    {

      "Id": 1250,

      "Name": "Category",

      "DisplayName": "Category",

      "DataType": "int",

      "ReferenceType": "SysDefCategory",

      "IsReference": true,

      "MaxLength": null

    },

    {

      "Id": 858,

      "Name": "BaseEndUser",

      "DisplayName": "Requester",

      "DataType": "int",

      "ReferenceType": "Person",

      "IsReference": true,

      "MaxLength": null

    },

    {

      "Id": 859,

      "Name": "BaseAgent",

      "DisplayName": "Assignee",

      "DataType": "int",

      "ReferenceType": "Person",

      "IsReference": true,

      "MaxLength": null

    },

    {

      "Id": 860,

      "Name": "BaseHeader",

      "DisplayName": "Subject",

      "DataType": "string",

      "ReferenceType": null,

      "IsReference": false,

      "MaxLength": 500

    },

    {

      "Id": 861,

      "Name": "BaseDescription",

      "DisplayName": "Description",

      "DataType": "string",

      "ReferenceType": null,

      "IsReference": false,

      "MaxLength": null

    }

   ]

  },

  "Errors": null,

  "IsError": false

}

 

Linked tickets (Add)

/**

 * Establishes an "AssociatedTo" relationship between tickets to enhance ticket management by linking related issues.

 * - Uses "entityType": "Ticket" and "Relations" to define the relationship between source and destination tickets.

 */

API Endpoint: {{apiurl}}/api/publicapi/SaveEntity

{

    "entityType""Ticket",

    "Id"11292,

    "Relations": [

        {

            "SourceId"11292,

            "SourceEntityTypeId"112,

            "DestinationId"11270,

            "DestinationEntityTypeId"112,

            "RelationType""AssociatedTo",

            "Status"1

        }

    ]

}

 

 

 

Linked tickets (Delete)

/**

* Removes an "AssociatedTo" relationship between tickets, streamlining ticket management by eliminating outdated links.

* - Targets "Ticket" entity to delete specified relationships, using "Relations" to detail the link to be removed.

 */

API Endpoint: {{apiurl}}/api/publicapi/SaveEntity

{

    "entityType""Ticket",

    "Id"11290,

    "Relations": [

        {

            "Id"1861//from SYS_DEF_ASSOCIATED_ENTITY table

            "SourceId"11290,

            "SourceEntityTypeId"112,

            "DestinationId"11270,

            "DestinationEntityTypeId"112,

            "RelationType""AssociatedTo",

            "Status"-1

        }

    ]

}

 

Linked tickets with CI (Add)

/**

 * Creates a "CiTicketReference" link between a ticket and a Configuration Item (CI), enhancing ticket details for better issue resolution and asset tracking.

 * - Utilizes ticket ID and "Cis" array to define the CI relationship, marking it as active with "Status": 1.

 */

API Endpoint: {{apiurl}}/api/publicapi/SaveEntity

 

{

    "Id"11292,

    "EntityType""Ticket",

    "Cis": [

        {

            "SourceId"11292,

            "SourceEntityType""Ticket",

            "RelationType""CiTicketReference",

            "DestinationId"268719,

            "DestinationEntityType""Ci",

            "Status"1

        }

    ]

}

 

 

Unlink ticket with CI (Delete)

/**

 * Deletes a "CiTicketReference" link between a ticket and a CI, simplifying ticket management by removing non-relevant CI associations.

 * - Targets a "Ticket" entity to sever specified CI relationships, marking them for deletion with "Status": -1.

 */

 * API Endpoint: {{apiurl}}/api/publicapi/SaveEntity

 

{

    "Id"11270,

    "EntityType""Ticket",

    "Cis": [

        {

            "Id"3153//from tm.TicketCiReference table

            "SourceId"11270,

            "SourceEntityType""Ticket",

            "RelationType""CiTicketReference",

            "DestinationId"268719,

            "DestinationEntityType""Ci",

            "Status"-1

        }

    ]

}

 

CI relationship (Add)

/**

 * Establishes a new relationship between CIs or a CI and another entity, defining specific association types to enhance infrastructure connectivity.

 * - Initiates with a "Ci" entity type, using "Relations" to specify relationship details and mark it as active with "Status": 1.

 */

API Endpoint: {{apiurl}}/api/publicapi/SaveEntity

{

    "entityType""Ci",

    "Id"269594,

    "Relations": [

        {

            "RelationTypeId"56,

            "SourceId"269594,

            "SourceEntityTypeId"1,

            "DestinationEntityTypeId"2,

            "DestinationId"11227,

            "IsInverted"false,

            "Status"1

        }

    ]

}

 

 

 

CI relationship (Delete)

/**

This code deletes an existing relationship between CIs or between a CI and another entity by removing a specified association. It identifies the CI and relation to delete by setting the relation's status to "-1".

*/

API Endpoint: {{apiurl}}/api/publicapi/SaveEntity

{

    "entityType""Ci",

    "Id"269597,

    "Relations": [

        {

            "Id"2232,//from cmdb.Relations table

            "RelationTypeId"56,

            "SourceId"269597,

            "SourceEntityTypeId"1,

            "DestinationEntityTypeId"2,

            "DestinationId"11227,

            "IsInverted"false,

            "Status"-1

        }

    ]

}

 

Get CI types

/**

It fetches a paginated list of CI types that match provided filter criteria like name. It allows querying the system to obtain different CI types to facilitate configuration management and integration tasks. The request specifies the entity type, pagination details, and filter criteria for CI type name.

*/

API Endpoint: {{apiurl}}/api/publicapi/SaveEntity

 

{

    "entityType""citype",

    "page"1,

    "pageSize"20,

    "filters": {

        "field""Name",

        "operator""eq",

        "value""test"

    }

}