Skip to main content

Get Analysis Results

PhenoNetAbout 2 min

Introduction

Query task execution results.

Request Description

API address: https://api.phenonet.org/api/v1/openapi/classification/
Request method: HTTPS GET
Return format: JSON
Content-Type: multipart/form-data
Headers: {"accessID": {{STRING}}, "secretKey": {{STRING}}}
Body: {"task_id": {{STRING}}}

Parameter Description

parameterdata typedescriptionvaluerequired
accessIDstringaccessID is required when sending requestssee Step I: Get AI&SKTrue
secretKeystringsecretKey is required when sending requestssee Step I: Get AI&SKTrue
task_idstringtask unique identification-True

Response Description

{
    "code": "{{INTEGER}}",
    "msg": "{{STRING}}",
    "data": {
        "task_id": "{{STRING}}",
        "file_path": "{{STRING}}",
        "model_id": "{{STRING}}",
        "user": "{{STRING}}",
        "task_name": "{{STRING}}",
        "create_date": "{{STRING}}",
        "is_finished": "{{INTEGER}}",
        "stage": "{{INTEGER}}"
    }
}

Returned parameter description

parameterdata typedescription
codeintegerstate code
msgstringreference information
task_idstringtask Unique Identification
file_pathstring-
model_idstring-
userstring-
task_namestring-
create_datestring-
is_finishedinteger0: queue / 1: processing / 2: success / 3: error
stageinteger1: jointing to booting stage (J-B)
2: heading stage (H),
3: flowering stage (F),
4: grain filling stage (G-F)
5: mature stage (M)

Example Code

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import requests

ACCESS_ID = ''
SECRET_KEY = ''

HEADERS = {
    "accessID": ACCESS_ID,
    "secretKey": SECRET_KEY
}


def get_task_status(task_id):
    url = "https://api.phenonet.org/api/v1/openapi/classification"
    params = {
        'task_id': task_id,
    }
    try:
        response = requests.get(url, headers=HEADERS, params=params)
        response.raise_for_status()
        return response.json()
    except requests.exceptions.RequestException as e:
        print('Exception occurred while obtaining task status: ', e)
        return None


if __name__ == '__main__':
    task_id = ''
    status_res = get_task_status(task_id)
    if status_res:
        print(status_res)

Error Code

codedescription
403AI (Access ID) or SK (Secret Key) error
Contributors: PhenoNet