# Get job results

## JOB RESULT

<mark style="color:blue;">`GET`</mark> `https://api.playment.io/v1/projects/:project_id/jobs/:job_id`

This endpoint allows you to get the annotations created on a job.

#### Path Parameters

| Name        | Type   | Description                                                                              |
| ----------- | ------ | ---------------------------------------------------------------------------------------- |
| job\_id     | string | ID of the job. You would have received this ID in the response when you created the job. |
| project\_id | string | ID of the project where the job was created                                              |

#### Headers

| Name      | Type   | Description                |
| --------- | ------ | -------------------------- |
| x-api-key | string | API key for authentication |

{% tabs %}
{% tab title="200 Job results successfully retrieved." %}

```javascript
{
    "data": {
        "project_id": "905ea3ee-6f62-4bb7-8c31-471e486d9202",
        "reference_id": "001",
        "job_id": "3f3e8675-ca69-46d7-aa34-96f90fcbb732",
        "batch_id": "468b6ae3-e98d-4d08-9427-b6e7a016054c",
        "status": "completed",
        "work_flow_id": "51bb440c-f0ed-4286-8984-ea399cbc1f9w",
        "priority_weight": 5,
        "tag": "2aae1234-acac-1234-eeff-12a22a237bbc", //tag is the workflow_id for the job  
        "result": "https://playment-data-uploads.s3.ap-south-1.amazonaws.com/sample-result.json"
    },
    "success": true
}
```

{% endtab %}
{% endtabs %}

## ATTACHMENT

<mark style="color:blue;">`GET`</mark> `https://api.playment.io/v1/attachments?url=:result_url`

The *result\_url* (`data.result`) returned by the GET Job result API is a private URL (Well, it's public till 15th July 2021, after which we'll enforce it to be private). You need to use this Attachment access API to securely fetch the results. Please refer to the Attachment Access API document for more detail.

#### Path Parameters

| Name        | Type   | Description                                   |
| ----------- | ------ | --------------------------------------------- |
| result\_url | string | Result URL returned by the GET job result API |

#### Headers

| Name      | Type   | Description                |
| --------- | ------ | -------------------------- |
| x-api-key | string | API key for authentication |

{% tabs %}
{% tab title="200 " %}

```
The API will redirect to a signed URL of the attachment
```

{% endtab %}
{% endtabs %}

## Result Object

```javascript
{
  "data": {
    "annotations": {
      "rectangles": [],
      "polygons": [],
      "lines": [],
      "cuboids": [],
      "landmarks": []
    },
    "image_url":"https://s3.aws.com/600x400/000/fff.jpg&text=Dummy+Image+1"
  }
}
```

The rectangles list contains objects, where each object is an annotation. You can check the data structures for various annotation types below:&#x20;

{% tabs %}
{% tab title="Rectangles" %}
![](https://1898243238-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MAyflu2a3TSnjJox7Sw%2F-MUCk3YWHepmJxcKntuA%2F-MUCkM9VbOuE7q8UxMWD%2Fbb.svg?alt=media\&token=6a8ce4a5-b35e-4935-a179-467cb7981cbb)

```javascript
"rectangles": [
  {
    "_id": "0e6d895e-2484-439a-b62b-d8a0afb3d190",
    "label": "Chair".
    "attributes": {
      "Truncation": {
        "value": "0% Truncated"
      },
      "Occlusion": {
        "value": "0% Occluded"
      }
    }
    "coordinates": [
      {"x": 0.00398, "y": 0.00558},
      {"x": 0.05404, "y": 0.00558},
      {"x": 0.05404, "y": 0.09096},
      {"x": 0.00398, "y": 0.09096}
    ]
  }
]
```

{% endtab %}

{% tab title="Polygons" %}
![](https://1898243238-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MAyflu2a3TSnjJox7Sw%2F-MUCk3YWHepmJxcKntuA%2F-MUCkaYRlEosNpzOW_v4%2Fpolygon.svg?alt=media\&token=7735d675-f8c5-488a-a040-430736b1ff9c)

```javascript
"polygons": [
  {
    "_id": "8f8897ad-e07b-4e55-9dbe-61f6b9df85c5",
    "label": "Pedestrian Crossing",
    "attributes": {
      "Type": {
        "value": "Dashed"
      },
      "Occlusion": {
        "value": "0% - 25% Occluded"
      },
      "Truncation": {
        "value": "0% Truncated"
      }
    }
    "points": {
      "p1": {"x": 0.286774, "y": 0.892502},
      "p2": {"x": 0.385849, "y": 0.576888},
      "p3": {"x": 0.426721, "y": 0.469081},
      "p4": {"x": 0.288623, "y": 0.253878},
      "p5": {"x": 0.148623, "y": 0.353878}
    },
    "edges": {
      "e1": ["p1", "p2"],
      "e2": ["p2", "p3"],
      "e3": ["p3", "p4"],
      "e4": ["p4", "p4"],
      "e5": ["p5", "p1"]
    }
  }
]
```

{% endtab %}

{% tab title="Lines" %}
![](https://1898243238-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MAyflu2a3TSnjJox7Sw%2F-MUCk3YWHepmJxcKntuA%2F-MUCkrkajq97qmWCuX4p%2Fline.svg?alt=media\&token=a7f0d7ee-f41e-4b5b-96ea-43e8e4d9f046)

```javascript
"lines": [
  {
    "_id": "8f8897ad-e07b-4e55-9dbe-61f6b9df85c5",
    "label": "Single SOlid Line",
    "attributes": {
      "Color": {
        "value": "Yellow"
      },
    }
    "points": {
      "p1": {"x": 0.286774, "y": 0.892502},
      "p2": {"x": 0.285849, "y": 0.876888},
      "p3": {"x": 0.286774, "y": 0.869081},
      "p4": {"x": 0.288623, "y": 0.853878}
    }
  }
]
```

{% endtab %}

{% tab title="Cuboids" %}
![](https://1898243238-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MAyflu2a3TSnjJox7Sw%2F-MUCk3YWHepmJxcKntuA%2F-MUCl06acI_VsbDOlEgi%2Fcuboid.svg?alt=media\&token=4c5276bf-40fe-4025-bd61-6e9fc30a82b7)

```javascript
"cuboids": [
  {
    "_id": "8f8897ad-e07b-4e55-9dbe-61f6b9df85c5",
    "label": "Car",
    "attributes" : {
      "faces_visible": {
        "value": ["right","back"]
      },
      "Type": {
        "value": "Sedan"
      }
    },
    "points": {
      "p1": {"x": 0.17,"y": 0.58},
      "p2": {"x": 0.26,"y": 0.58},
      "p3": {"x": 0.26,"y": 0.49},
      "p4": {"x": 0.17,"y": 0.49},
      "p5": {"x": 0.24,"y": 0.51},
      "p6": {"x": 0.35,"y": 0.52},
      "p7": {"x": 0.35,"y": 0.36},
      "p8": {"x": 0.25,"y": 0.37}
    },
    "front": {
      "coordinates": ["p1","p2","p3","p4"]
    },
    "side": {
      "coordinates": ["p2","p3","p5","p6"]
    },
    "back": {
      "coordinates": ["p7","p8","p5","p6"]
    }
  }
]
```

{% endtab %}

{% tab title="Landmarks" %}
![](https://1898243238-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MAyflu2a3TSnjJox7Sw%2F-MUCk3YWHepmJxcKntuA%2F-MUClBd_ttH_TwfFu2pl%2Flandmark.svg?alt=media\&token=b37cd1cf-11d1-4b0f-848c-0a4163553cbf)

```javascript
"landmarks": [
  {
    "_id": "e7e3353f-2ffe-432a-a14f-9cb9a6f4b735",
    "label": "Eye",
    "attributes": {
      "Type": {
        "value": "Open"
      },
    }
    "points": {
      "p1": { "x": 0.17, "y": 0.58, "label": 1 },
      "p2": { "x": 0.26, "y": 0.63, "label": 2 },
      "p3": { "x": 0.27, "y": 0.63, "label": 3 },
      "p4": { "x": 0.29, "y": 0.59, "label": 4 },
      "p5": { "x": 0.25, "y": 0.46, "label": 5 },
      "p6": { "x": 0.22, "y": 0.42, "label": 6 }
    }
  }
]
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
In our annotation output, the **x and y coordinates are normalised** to ensure consistency across different image sizes. Normalisation is crucial for accurately representing object positions relative to the image dimensions.

**X and Y Coordinates:**

* **X Coordinate:**
  * Normalised x coordinates ($$Xnorm​$$) are calculated using the formula: \
    $$Xnorm = Xraw / Image Width$$
  * The result ranges from 0.0 to 1.0, where 0.0(Origin) corresponds to the leftmost edge of the image, and 1.0 corresponds to the rightmost edge.
* **Y Coordinate:**
  * Normalised y coordinates ($$Ynorm​$$) are calculated using the formula: \
    $$Ynorm = Yraw / Image Height$$
  * The result ranges from 0.0 to 1.0, where 0.0(Origin) corresponds to the topmost edge of the image, and 1.0 corresponds to the bottommost edge.
    {% endhint %}
