Stop a Function Instance - Cognigy Documentation

Documentation Index

Fetch the complete documentation index at: /llms.txt

Use this file to discover all available pages before exploring further.

Stop a Function Instance

POST /v2.0/functions/{functionId}/instances/{functionInstanceId}/stop

Example cURL Command

curl --request POST \
  --url https://api-trial.cognigy.ai/new/v2.0/functions/{functionId}/instances/{functionInstanceId}/stop \
  --header 'X-API-Key: <api-key>'

Example Python Code

import requests

url = "https://api-trial.cognigy.ai/new/v2.0/functions/{functionId}/instances/{functionInstanceId}/stop"

headers = {"X-API-Key": "<api-key>"}

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

print(response.text)

Example JavaScript Code

const options = {method: 'POST', headers: {'X-API-Key': '<api-key>'}};

fetch('https://api-trial.cognigy.ai/new/v2.0/functions/{functionId}/instances/{functionInstanceId}/stop', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));

Example PHP Code

$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://api-trial.cognigy.ai/new/v2.0/functions/{functionId}/instances/{functionInstanceId}/stop",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_HTTPHEADER => [
    "X-API-Key: <api-key>"
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}

Example Go Code

package main

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

func main() {

url := "https://api-trial.cognigy.ai/new/v2.0/functions/{functionId}/instances/{functionInstanceId}/stop"

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

req.Header.Add("X-API-Key", "<api-key>")

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

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

fmt.Println(string(body))
}

API Response Status Codes

Status Code Error Type Description
400 Bad Request Validation failed. Missing payload.
401 Unauthorized
402 Payment Required Validation failed. Missing payload.
403 Forbidden
404 Not Found
405 Method Not Allowed
409 Conflict
413 Payload Too Large
500 Internal Server Error
501 Not Implemented
502 Bad Gateway
503 Service Unavailable
504 Gateway Timeout

Authorization

X-API-Key
Type: string
Location: header
Required: Supply the API Key in the HTTP-Header

Request Headers

Header Description
Accept The Accept header specifies the media type that the client expects in the response. Available options: application/json, application/hal+json, application/xml, text/xml, text/csv. The default value is application/json.

Path Parameters

Parameter Type Required Description
functionId string true The Id of the Function
functionInstanceId string true The Id of the Function Instance

Response

202: The stop operation was accepted.