Request: POST /papi/v1/asset/search

Parameter Parameter Type Mandatory Description
Search info Body yes Search query in JSON format, see examples below
x-auth-token Header yes The authentication token must be provided as a x-auth-token header for every api request.
More information about authentication token.

Query parameters:

Query Parameters Parameter Type Mandatory Description
SearchField string yes Field to search from
SearchOption string no Search option behavior
ValuesList array yes Value or values to search
Exclude boolean no Exclude the SearchField

Note when using SearchOption = Regex the following queries are not supported:

  • Character classes: \d, \w, \s
  • Flags (e.g. /g, /i)
  • Anchor Operators: ^, $

Examples

Folder Search

The below example is search the assets in the folder “gmXs” and its subfolders.

 [
  {
    "SearchField": "FolderId",
    "SearchOption": "IncludeSubfolders",
    "ValuesList": [
      "gmXs"
    ]
  }
]

The below example is search the assets in the folder “gmXs” only.

 [
  {
    "SearchField": "FolderId",
    "ValuesList": [
      "gmXs"
    ]
  }
]

The below example is search the all assets excluding the asset in the folder “gmXs” and its subfolders.

 [
  {
    "SearchField": "FolderId",
    "SearchOption": "IncludeSubfolders",
    "ValuesList": [
      "gmXs"
    ],
    "Exclude": true
  }
]

Name search

Search all asset where asset name contains the letters ‘test’.

 [
  {
    "SearchField": "Name",
    "SearchOption": "contains",
    "ValuesList": [
      "test"
    ]
  }
]

Search all asset where asset name = “SGR28815”

 [
  {
    "SearchField": "Name",
    "SearchOption": "Exactly",
    "ValuesList": [
      "SGR28815"
    ]
  }
]

Search all asset where asset name contains the word “image”.

 [
  {
    "SearchField": "Name",
    "SearchOption": "containwords",
    "ValuesList": [
      "image"
    ]
  }
]

Combined search

Search queries can be combined putting the queries in an array.

example searching from folder id “gmXs” and its subfolders with name field containing “test”

 [
  {
    "SearchField": "FolderId",
    "SearchOption": "IncludeSubfolders",
    "ValuesList": [
      "gmXs"
    ]
  },
  {
    "SearchField": "Name",
    "SearchOption": "contains",
    "ValuesList": [
      "test"
    ]
  }
]

cURL example

curl --location --request POST 'https://[EMMi instance]/papi/v1/asset/search' \
--header 'x-auth-token: [Session token]' \
--header 'Content-Type: application/json' \
--data-raw ' [
  {
    "SearchField": "FolderId",
    "SearchOption": "IncludeSubfolders",
    "ValuesList": [
      "gmXs"
    ]
  }
]'

Feedback

Was this helpful?

Yes No
You indicated this topic was not helpful to you ...
Could you please leave a comment telling us why? Thank you!
Thanks for your feedback.

Post your comment on this topic.

Post Comment