Skip to content
TK Portal Documentation
Search Policies API
latest

Search Policies API🔗

Managing Search policies🔗

TK Portal exposes a Search Policy API. Whenever a new access role needs to be created or added, for instance due to a new tenant/business or unit/department being onboarded, the Search Policy API is to be called to create a new policy with the new associated access role(s), or to add the new access role(s) to an existing policy.

Managing Search Policies

The Search Policy API can also be used to list the current Search policies in place for a specific TK Portal account, to update/modify them or delete them.

All aforementioned functions are accessible by RESTful web services. The respective credentials and staging/production endpoints can be provided by a Textkernel consultant.

A few examples of calls to the Search Policy API are provided below as a starting point. More information can be found in the User Management API section.

Example API Requests🔗

Create or update a Search policy with access role "tenant1"🔗

/portal/config/searchPolicy

PUT /portal/config/searchPolicy

Method Media Type Description
PUT application/json Create or update an access role corresponding to a Search policy

The Search policy defines the access role that will be used for candidate searching and job searching in Search! application. It is possible to create multiple policies in one go by extending the list of objects.

[
    {
        "name":"policy1",
        "searchRoles":[
            {
                "name":"tenant1",
                "searchRef":"candidateSearch"
            },
            {
                "name":"tenant1",
                "searchRef":"jobSearch"
            }
        ],
        "sharesWith":[
            "policy1"
        ]
    }
]

Where all names are case-sensitive, and:

Name Description
name Search policy name, e.g. "policy1"
searchRoles Access role information
searchRoles.name Access role name, e.g. "tenant1"
searchRoles.searchRef is the (valid) ID of a Search environment configured for the TK Portal account. This is provided by a Textkernel consultant
sharesWith Used for project sharing between users of same the tenant, e.g. ["policy1"]

Invalid searchRef

The value of searchRoles.searchRef is case-sensitive and must match the value provided by a Textkernel consultant. If a different value is sent, the policy might still be created but it will not grant users the correct access rights.

Request🔗

curl -X 'PUT' -u <account name>:<account password> "https://home.textkernel.nl/portal/config/searchPolicy" -H 'Content-Type: application/json' -d '[{ "name": "policy1", "searchRoles": [  {  "searchRef": "candidateSearch",  "name": "tenant1"  },  {  "searchRef": "jobSearch",  "name": "tenant1"  } ], "sharesWith": ["policy1"] }]'

Response🔗

[
    {
        "uuid":"8a3391d6687b063301688088698b000c",
        "name":"policy1",
        "searchRoles":[
            {
                "name":"tenant1",
                "searchRef":"candidateSearch",
                "uuid":"8a3391d6687b0633016880886991000d"
            },
            {
                "name":"tenant1",
                "searchRef":"jobSearch",
                "uuid":"8a3391d6687b0633016880886991000e"
            }
        ],
        "members":[

        ],
        "portalRoles":[

        ],
        "sharesWith":[
            "policy1"
        ],
        "receivesFrom":[

        ],
        "shareableAsRole":false,
        "defaultSearchPolicy":false,
        "created":"2019-01-24T16:44:10+01",
        "updated":"2019-01-24T16:44:10+01"
    }
]

List current Search policies🔗

/portal/config/searchPolicy

GET /portal/config/searchPolicy

Method Media Type Description
GET application/json Retrieves a list of existing Search policies for a TK Portal account

Request🔗

curl -X 'GET' -u <account name>:<account password> "https://home.textkernel.nl/portal/config/searchPolicy"

Response🔗

[
    {
        "uuid":"8a3391d6687b063301688088698b000c",
        "name":"policy1",
        "searchRoles":[
            {
                "name":"tenant1",
                "searchRef":"candidateSearch",
                "uuid":"8a3391d6687b0633016880886991000d"
            },
            {
                "name":"tenant1",
                "searchRef":"jobSearch",
                "uuid":"8a3391d6687b0633016880886991000e"
            }
        ],
        "members":[

        ],
        "portalRoles":[

        ],
        "sharesWith":[
            "policy1"
        ],
        "receivesFrom":[

        ],
        "shareableAsRole":false,
        "defaultSearchPolicy":false,
        "created":"2019-01-24T16:44:10+01",
        "updated":"2019-01-24T16:44:10+01"
    }
]

Delete a Search policy🔗

/portal/config/searchPolicy

DELETE /portal/config/searchPolicy

In order to offboard a tenant, the Search policy should be deleted.

Warning

This operation only deletes the Search policy. It does not delete any users or any data indexed in Search! that is associated to the policy.

Method Media Type Description
DELETE application/json Deletes a Search policy for a TK Portal account

Request🔗

curl --verbose -X 'DELETE' -u <account name>:<account password> "https://home.textkernel.nl/portal/config/searchPolicy/policy1"

Response🔗

200 OK + message that the Search policy was deleted, or error.