# Get generation job status

> 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/api/v-1/adapter-scripts/jobs/job-id/llms.txt.
> For full documentation content, see https://apidocs.cata.sg/pos-integration-service-api/api/v-1/adapter-scripts/jobs/job-id/llms-full.txt.

GET http://localhost:8080/api/v1/adapter-scripts/jobs/{jobId}

Poll this endpoint to track generation progress. Key fields:
- `status`: pending, running, needs_clarification, completed, failed
- `stage`: queued, gathering, generating, testing, retrying, done
- `hypothesis`: current generated script (work in progress)
- `testResults`: array of test attempts with pass/fail
- `clarification`: AI's question (when status = needs_clarification)
- `logs`: array of stage log entries


Reference: https://apidocs.cata.sg/pos-integration-service-api/api/v-1/adapter-scripts/jobs/job-id/get-generation-job-status

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: collection
  version: 1.0.0
paths:
  /api/v1/adapter-scripts/jobs/{jobId}:
    get:
      operationId: get-generation-job-status
      summary: Get generation job status
      description: |
        Poll this endpoint to track generation progress. Key fields:
        - `status`: pending, running, needs_clarification, completed, failed
        - `stage`: queued, gathering, generating, testing, retrying, done
        - `hypothesis`: current generated script (work in progress)
        - `testResults`: array of test attempts with pass/fail
        - `clarification`: AI's question (when status = needs_clarification)
        - `logs`: array of stage log entries
      tags:
        - >-
          subpackage_api.subpackage_api/v1.subpackage_api/v1/adapterScripts.subpackage_api/v1/adapterScripts/jobs.subpackage_api/v1/adapterScripts/jobs/jobId
      parameters:
        - name: jobId
          in: path
          description: Generation job ID
          required: true
          schema:
            type: string
        - name: X-Api-Key
          in: header
          required: true
          schema:
            type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/api_v1_adapter-scripts_jobs_{jobId}_Get
                  generation job status_Response_200
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/GetApiV1Adapter-scriptsJobsJobidRequestNotFoundError
servers:
  - url: http://localhost:8080
components:
  schemas:
    ApiV1AdapterScriptsJobsJobIdGetResponsesContentApplicationJsonSchemaJobTestResultsItems:
      type: object
      properties:
        attempt:
          type: integer
        passed:
          type: boolean
        error:
          type: string
        outputPreview:
          type: string
        outputCount:
          type: integer
        timestamp:
          type: string
          format: date-time
      required:
        - attempt
        - passed
        - error
        - outputPreview
        - outputCount
        - timestamp
      title: >-
        ApiV1AdapterScriptsJobsJobIdGetResponsesContentApplicationJsonSchemaJobTestResultsItems
    ApiV1AdapterScriptsJobsJobIdGetResponsesContentApplicationJsonSchemaJobLogsItems:
      type: object
      properties:
        stage:
          type: string
        message:
          type: string
        timestamp:
          type: string
          format: date-time
      required:
        - stage
        - message
        - timestamp
      title: >-
        ApiV1AdapterScriptsJobsJobIdGetResponsesContentApplicationJsonSchemaJobLogsItems
    ApiV1AdapterScriptsJobsJobIdGetResponsesContentApplicationJsonSchemaJob:
      type: object
      properties:
        id:
          type: integer
        provider:
          type: string
        topic:
          type: string
        status:
          type: string
        stage:
          type: string
        hypothesis:
          type: string
        testResults:
          type: array
          items:
            $ref: >-
              #/components/schemas/ApiV1AdapterScriptsJobsJobIdGetResponsesContentApplicationJsonSchemaJobTestResultsItems
        clarification:
          type: string
        humanResponse:
          type: string
        logs:
          type: array
          items:
            $ref: >-
              #/components/schemas/ApiV1AdapterScriptsJobsJobIdGetResponsesContentApplicationJsonSchemaJobLogsItems
        retries:
          type: integer
        resultScriptId:
          type: integer
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
      required:
        - id
        - provider
        - topic
        - status
        - stage
        - hypothesis
        - testResults
        - clarification
        - humanResponse
        - logs
        - retries
        - resultScriptId
        - createdAt
        - updatedAt
      title: ApiV1AdapterScriptsJobsJobIdGetResponsesContentApplicationJsonSchemaJob
    api_v1_adapter-scripts_jobs_{jobId}_Get generation job status_Response_200:
      type: object
      properties:
        code:
          type: integer
        isSuccess:
          type: boolean
        message:
          type: string
        job:
          $ref: >-
            #/components/schemas/ApiV1AdapterScriptsJobsJobIdGetResponsesContentApplicationJsonSchemaJob
      required:
        - code
        - isSuccess
        - message
        - job
      title: >-
        api_v1_adapter-scripts_jobs_{jobId}_Get generation job
        status_Response_200
    ApiV1AdapterScriptsJobsJobIdGetResponsesContentApplicationJsonSchemaError:
      type: object
      properties:
        code:
          type: integer
        message:
          type: string
        details:
          type: string
        field:
          type: string
      required:
        - code
        - message
        - details
        - field
      title: >-
        ApiV1AdapterScriptsJobsJobIdGetResponsesContentApplicationJsonSchemaError
    GetApiV1Adapter-scriptsJobsJobidRequestNotFoundError:
      type: object
      properties:
        error:
          $ref: >-
            #/components/schemas/ApiV1AdapterScriptsJobsJobIdGetResponsesContentApplicationJsonSchemaError
      required:
        - error
      title: GetApiV1Adapter-scriptsJobsJobidRequestNotFoundError
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: X-Api-Key

```

## SDK Code Examples

```python api_v1_adapter-scripts_jobs_{jobId}_Get generation job status_example
import requests

url = "http://localhost:8080/api/v1/adapter-scripts/jobs/5719"

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

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

print(response.json())
```

```javascript api_v1_adapter-scripts_jobs_{jobId}_Get generation job status_example
const url = 'http://localhost:8080/api/v1/adapter-scripts/jobs/5719';
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 api_v1_adapter-scripts_jobs_{jobId}_Get generation job status_example
package main

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

func main() {

	url := "http://localhost:8080/api/v1/adapter-scripts/jobs/5719"

	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 api_v1_adapter-scripts_jobs_{jobId}_Get generation job status_example
require 'uri'
require 'net/http'

url = URI("http://localhost:8080/api/v1/adapter-scripts/jobs/5719")

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 api_v1_adapter-scripts_jobs_{jobId}_Get generation job status_example
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("http://localhost:8080/api/v1/adapter-scripts/jobs/5719")
  .header("X-Api-Key", "<apiKey>")
  .asString();
```

```php api_v1_adapter-scripts_jobs_{jobId}_Get generation job status_example
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'http://localhost:8080/api/v1/adapter-scripts/jobs/5719', [
  'headers' => [
    'X-Api-Key' => '<apiKey>',
  ],
]);

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

```csharp api_v1_adapter-scripts_jobs_{jobId}_Get generation job status_example
using RestSharp;

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

```swift api_v1_adapter-scripts_jobs_{jobId}_Get generation job status_example
import Foundation

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

let request = NSMutableURLRequest(url: NSURL(string: "http://localhost:8080/api/v1/adapter-scripts/jobs/5719")! 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()
```