Search for a Resource

This API is used to search for a resource based on input filter condition. A resource is a logical entity to group one or more ACL managed entities. The response could be one or more resource(s) matching the input.

Before you begin

  • Session ID is obtained from the login API.
  • Ensure that the session ID is valid and has not expired.
  • Make sure you have valid filter value for search.

Request Structure

Endpoint: /resource-search
Type: POST
Sample URL: https://<IP/HostName/TenantName>:<GWPORT>/avxapi/resource-search?gwsource=external

To understand the elements of the sample URL, click here.

Headers:
Content-Type: application/json
Table 1. Input Parameters
Name Description
sessionId (or) Token

Header

(Mandatory) Use either Session Id or Token received after login.

Type: String

Example: "sessionId": "ce7f1a14-2bf9-4e4a-89a8-bc780a255813"

Token

Query

(Mandatory) Access token received after login.

Type: String

Example: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJwbGF0Zm9y bSIsImF1ZCI6ImF2eCIsImNsaWVudElkIjoiOTcwNzRlNDEtOGFmOS00NTZkL TlhNjQtZjBjNGJiOTA4MDQ4IiwiaXNzIjoiYXZ4IiwiZXhwIjoxNjUwMzY5MzY3LCJncm FudCB0eXBlIjoiY2xpZW50X2NyZWRlbnRpYWxzIn0.HZnkuUEjXIeqJWqpqi NWFHqI DI7GYf4cWx6VwbjGD_0

gwsource

Query

(Mandatory) Source from which the request is triggered. The values can be:
  • web
  • external

Type: String

Payload

String

(Mandatory) Input data for request body in application/json format. For payload details, see Payload section.

Payload

Name Description
startIndex

Integer

(Optional) Start index to show in output in case if there are more than one matching records.

Example: "1"

maxSize

Integer

(Optional) The number of records to return in a response. maxSize is starting from the start index.

Example: "3"

sortOrder

String

(Optional) The order to sort. Possible values are asc and desc.

Example: "asc"

sortColumn

String

(Optional) Column by which the output has to be sorted.

Example: "name"

filterValue

String

(Optional) Input filter string value to filter the resources.

Example: "resource_1"

Response Structure

  • Status Code: 200 OK
  • Message: Matching results found for the given input.
  • Headers:
    • Content-Type: application/json
Table 2. Response Parameters
Name Description
response Contains the response attributes for search of resource successfully.
message Success message or failure description in case of error.
appStatusCode Application specific status code for the response. Will be non-null for failure response.
tags More info in case of failure response.

Status Codes

HTTP Code appStatusCode Response Message
200 OK null Matching results found for the given input.
404 Not Found DG_009 No matching records found
401 Unauthorized AVX_GW_012 Unauthorized access, reason - Invalid Token
400 Bad Request DG_006 Invalid sort Column.

Sample Request/Response

Use Case

Search a resource with the name Role_admin.

Sample Request
https://<IP/HostName/TenantName>:<GWPORT>/avxapi/resource-search?gwsource=external
Request Payload
{
 "payload": {
 "startIndex" : 1,
 "maxSize" : 3,
 "sortOrder":"asc",
 "sortColumn" : "name",
 "filterValue" : "resource_1"
 }
 }
Sample Response
{
 "response": {
 "data": [
 {
 "name": "Role_admin",
 "description": "Super access will have the permissions to access all the resources in AppViewX.",
 "state": "A",
 "_id": " Role_admin ",
 "_keywords": null
 }
 ],
 "totalRecords": 1,
 "obtainedRecords": 1,
 "obtainedRecordRange": {
 "start": 1,
 "end": 1
 }
 },
 "message": "Matching results found for the given input.",
 "appStatusCode": null,
 "tags": null,
 "headers": null
 }
Note: The state of a resource indicates if the resource is active or not. ‘A’ stands for active.

What's Next

Reference

Understanding the sample URL:
  • IP/HostName/TenantName: Replace with the actual IP address, hostname, or tenant name based on the specific configuration in AppViewX.
    • IP: A unique identifier assigned to each device connected to a computer network that uses the Internet Protocol for communication

      The IP address will be included in the endpoint URL for an on-prem deployment.

    • HostName: A human-readable label assigned to a device (host) on a network

      The hostname will be included in the endpoint URL for an on-prem deployment.

    • TenantName: An identifier label for a tenant given to indicate which tenant's data the API request will access/modify

      The tenant name will be included in the endpoint URL for a SaaS deployment.

  • GWPORT: AppViewX gateway port

    A gateway port refers to a network port through which data is sent and received to communicate with a gateway in an on-prem deployment.

    Example: 31443

  • avxapi: Path parameter value (static) that is part of the endpoint's URL
  • Endpoint: Endpoint of the API, for example: execute-hook
  • gwsource: Source or origin of a gateway, for example: external.