---
title: Best Non Empty match
slug: best-non-empty-match
docTags: 
createdAt: 2021-12-22T07:28:32.000Z
---

Use this to get the best non empty match of the two or more inputs. Clone this API to add more inputs



### API Definition

:::ApiMethodV2
```json
{
  "tab": "examples",
  "url": "https://orca.pathfix.com/functions/list/bestmatch",
  "name": "Best Non Empty Match API (Single Match)",
  "method": "POST",
  "request": {
    "pathParameters": [],
    "queryParameters": [],
    "headerParameters": [],
    "bodyDataParameters": [],
    "formDataParameters": []
  },
  "results": {
    "languages": [
      {
        "id": "28UsDqyeH3QRdmtVamSQT",
        "code": "{\n    \"output\": {\n        \"best_match\": \"Second Item\"\n    }\n}",
        "language": "200"
      },
      {
        "id": "yIX64DyIuDPJgBRFSfAWb",
        "code": "{\n    \"message\": \"error\"\n}",
        "language": "404"
      }
    ],
    "selectedLanguageId": "28UsDqyeH3QRdmtVamSQT"
  },
  "examples": {
    "languages": [
      {
        "id": "ENcJz9TStG38F0X-taA4x",
        "code": "{\r\n    \"bestmatches\": {\r\n        \"best_match\": {\r\n            \"input\": [\r\n                \"\",\r\n                \"Second Item\",\r\n                \"Third Item\"\r\n            ],\r\n            \"rule\": \"first_not_empty\"\r\n        }\r\n    }\r\n}",
        "language": "json"
      }
    ],
    "selectedLanguageId": "ENcJz9TStG38F0X-taA4x"
  },
  "description": "\nCall the following API to execute a single match:",
  "currentNewParameter": {
    "label": "Body Parameter",
    "value": "bodyDataParameters"
  }
}
```
:::




:::ApiMethodV2
```json
{
  "tab": "examples",
  "url": "https://orca.pathfix.com/functions/list/bestmatch",
  "name": "Best Non Empty Match API (Multiple Match)",
  "method": "POST",
  "request": {
    "pathParameters": [],
    "queryParameters": [],
    "headerParameters": [],
    "bodyDataParameters": [],
    "formDataParameters": []
  },
  "results": {
    "languages": [
      {
        "id": "cUO9akDHGAyeuRQdxWmZc",
        "code": "{\n    \"output\": {\n        \"name\": \"James Dean\",\n        \"status\":\"unknown\"\n    }\n}",
        "language": "200"
      },
      {
        "id": "YANvjqK3fGDHBRCL9FMhw",
        "code": "{\n    \"message\": \"error\"\n}",
        "language": "404"
      }
    ],
    "selectedLanguageId": "cUO9akDHGAyeuRQdxWmZc"
  },
  "examples": {
    "languages": [
      {
        "id": "h-y0mZjctMxEeAI79Q6EY",
        "code": "{\r\n    \"bestmatches\": {\r\n        \"name\": {\r\n            \"input\": [\r\n                \"james Dean\",\r\n                \"James\",\r\n                \"Dean\"\r\n            ],\r\n            \"rule\": \"first_not_empty\"\r\n        },\"status\": {\r\n            \"input\": [\r\n                \"\",\r\n                \"unknown\",\r\n            ],\r\n            \"rule\": \"first_not_empty\"\r\n        }\r\n    }\r\n}",
        "language": "json"
      }
    ],
    "selectedLanguageId": "h-y0mZjctMxEeAI79Q6EY"
  },
  "description": "\nCall the following API to execute multiple match:",
  "currentNewParameter": {
    "label": "Body Parameter",
    "value": "bodyDataParameters"
  }
}
```
:::














