Task status using only one request

Hi,

I’m trying to get the status of tasks based on the workfile, but using only one request… I’m using postman for these tests…

The url I’m using is the following:

{{host}}/api/v1/entity/:entity?fields=sg_entity.Asset.code,sg_path,sg_task&filter[project.Project.id]=278

This url returns the name of the assets, the path of the workfile and the task associated with the workfile…

But I couldn’t get the status of the task…

"relationships": {
    "sg_task": {
        "data": [
            {
                "id": 6828,
                "template_task_id": 6399,
                "name": "Rig",
                "type": "Task"
            }
        ],
        "links": {
            "self": "/api/v1/entity/custom_entity04s/509/relationships/sg_task"
        }
    }

Is there any way I could get the task status using only one request? Or should I do one search for each task to get its status?

Thank you

Probably by adding sg_task.Task.sg_status_list to the fields list.
What does your custom entity look like?

Hi mmoshev,

Thank you for your help, but it didn’t work. If I use sg_task.Task.sg_status_list, I got this error

{
    "errors": [
        {
            "id": "35dde8774297a32f09be5b9c1e8d570f",
            "status": 400,
            "code": 103,
            "title": "Request Parameters invalid.",
            "source": {
                "fields": [
                    "fields list is not valid"
                ]
            },
            "detail": null,
            "meta": null
        }
    ]
}

If I only use sg_status_list, I got the status of the asset, not the status of the task.

My entity fields looks like this ( Does this help? )

workfiles_customfields

Thank you