Should Creditsafe Connect ever return the following messaging then it's indicating that it isn't possible to combine some of the query parameters which are being sent in the /companies request: 


URIHTTP ACTION
/companies?countries={countryCode}&{criteriaSet}
GET


{
  "correlationId": "4f250320-3399-11ea-8d73-065ffabb5914",
  "message": "Bad request",
  "details": "Specified criteria combination is not allowed"
}


When searching for a company using Creditsafe Connect's /companies endpoint it's only possible to search one "criteriaSet" at a time so whilst it's possible to combine the "name" and "postCode" parameters because they persist within the same "criteriaSet", it isn't possible to combine a "regNo" parameter with a "name" parameter:


{
  "countries": [
    "GB"
  ],
  "languages": [
    "EN"
  ],
  "criteriaSets": [
    {
      "id": {
        "required": true
      }
    },
    {
      "safeNo": {
        "minLength": 10,
        "maxLength": 10,
        "validationRegExp": "GB\\d{8}",
        "required": true
      }
    },
    {
      "regNo": {
        "minLength": 2,
        "maxLength": 8,
        "required": true
      }
    },
    {
      "name": {
        "required": false
      },
      "type": {
        "allowedValues": [
          "Ltd",
          "NonLtd"
        ],
        "required": false
      },
      "status": {
        "allowedValues": [
          "Active",
          "NonActive"
        ],
        "required": false
      },
      "address": {
        "simpleValue": {
          "minLength": 2,
          "required": false
        },
        "street": {
          "required": false
        },
        "city": {
          "required": false
        },
        "postCode": {
          "minLength": 2,
          "required": false
        }
      },
      "phoneNo": {
        "required": false
      }
    }
  ]
}


The HTTP 400 Bad Request response is best avoided by calling Creditsafe Connect's /searchcriteria endpoint prior to forming the /companies request as it will return a list of all possible "criteriaSets" which could be individually searched to find a company:


URIHTTP ACTION
/companies/searchcriteria?countries={countryCode}
GET


When implementing a watertight search process we would strongly advise adopting the following call sequence to ensure of more efficient company searches:


1. /authenticate

2. /access/countries

3. /companies/searchcriteria?countries={countryCode}

4. /companies?countries={countryCode}&{criteriaSet}


Should further detail be required with regards to the searching of companies via Creditsafe Connect then please refer to the following web link:


Searching Companies


Should you continue to experience issues then please submit a ticket.