# Health check

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://apidocs.cata.sg/pos-integration-service-api/health/llms.txt.
> For full documentation content, see https://apidocs.cata.sg/pos-integration-service-api/health/llms-full.txt.

GET http://localhost:8080/health

Check the health status of the service and its dependencies

Reference: https://apidocs.cata.sg/pos-integration-service-api/health/health-check

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: collection
  version: 1.0.0
paths:
  /health:
    get:
      operationId: health-check
      summary: Health check
      description: Check the health status of the service and its dependencies
      tags:
        - subpackage_health
      parameters:
        - name: X-Api-Key
          in: header
          required: true
          schema:
            type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/health_Health check_Response_200'
        '503':
          description: Service Unavailable
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetHealthRequestServiceUnavailableError'
servers:
  - url: http://localhost:8080
components:
  schemas:
    health_Health check_Response_200:
      type: object
      properties:
        status:
          type: string
        service:
          type: string
        version:
          type: string
        database:
          type: string
        redis:
          type: string
        database_error:
          type: string
        redis_error:
          type: string
      required:
        - status
        - service
        - version
        - database
        - redis
        - database_error
        - redis_error
      title: health_Health check_Response_200
    GetHealthRequestServiceUnavailableError:
      type: object
      properties:
        status:
          type: string
        service:
          type: string
        version:
          type: string
        database:
          type: string
        redis:
          type: string
        database_error:
          type: string
        redis_error:
          type: string
      required:
        - status
        - service
        - version
        - database
        - redis
        - database_error
        - redis_error
      title: GetHealthRequestServiceUnavailableError
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: X-Api-Key

```

## SDK Code Examples

```python health_Health check_example
import requests

url = "http://localhost:8080/health"

headers = {"X-Api-Key": "<apiKey>"}

response = requests.get(url, headers=headers)

print(response.json())
```

```javascript health_Health check_example
const url = 'http://localhost:8080/health';
const options = {method: 'GET', headers: {'X-Api-Key': '<apiKey>'}};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go health_Health check_example
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "http://localhost:8080/health"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("X-Api-Key", "<apiKey>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby health_Health check_example
require 'uri'
require 'net/http'

url = URI("http://localhost:8080/health")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Get.new(url)
request["X-Api-Key"] = '<apiKey>'

response = http.request(request)
puts response.read_body
```

```java health_Health check_example
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("http://localhost:8080/health")
  .header("X-Api-Key", "<apiKey>")
  .asString();
```

```php health_Health check_example
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'http://localhost:8080/health', [
  'headers' => [
    'X-Api-Key' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp health_Health check_example
using RestSharp;

var client = new RestClient("http://localhost:8080/health");
var request = new RestRequest(Method.GET);
request.AddHeader("X-Api-Key", "<apiKey>");
IRestResponse response = client.Execute(request);
```

```swift health_Health check_example
import Foundation

let headers = ["X-Api-Key": "<apiKey>"]

let request = NSMutableURLRequest(url: NSURL(string: "http://localhost:8080/health")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```