Help Center> RES> API Reference> APIs (Old Version)> Job-related APIs> Submitting Effect Evaluation Jobs

Submitting Effect Evaluation Jobs

Function

This API is used to submit effect evaluation jobs.

URI

POST /v1/{project_id}/evaluate

Table 1 describes the URI parameters.

Table 1 URI parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID, which is used for resource isolation. For details about how to obtain the project ID, see Obtaining a Project ID.

Request

Table 2 describes the request parameters.

Table 2 Request parameters

Parameter

Mandatory

Type

Description

workspace_id

No

String

Workspace ID. The default value is 0.

job_name

Yes

String

Job name. The value contains 1 to 20 characters. Only letters, digits, hyphens (-), and underscores (_) are allowed.

job_description

No

String

Job description. The value can contain a maximum of 256 characters.

online_services

Yes

List

Online services that require effect evaluation.

indicators

Yes

List

List of metrics and related parameters. For details, see Table 3.

start_time

Yes

Long

Timestamp marking the start of data collection

end_time

Yes

Long

Timestamp marking the end of data collection

interval

Yes

Double

Interval, in days. The value is greater than 0.

result_path

Yes

String

Result save path

offline_platform

Yes

JSON

Configuration information. For details, see Table 8.

Table 3 indicators parameters

Parameter

Mandatory

Type

Description

indicator_name

Yes

String

Metric name. The options are as follows:

  • clickPV
  • clickPVRate
  • clickUV
  • clickUVRate
  • customize

indicator_params

-

JSON

Metric parameter. This parameter is mandatory when indicator_name is set to customize. For details, see Table 4.

Table 4 indicator_params parameters

Parameter

Mandatory

Type

Description

customize_parameter

Yes

JSON

Table 5 describes the custom parameters.

customize_formula

Yes

JSON

Table 6 describes the custom formula.

Table 5 customize_parameter parameters

Parameter

Mandatory

Type

Description

alias

Yes

String

Parameter alias, which is invoked in a custom formula and is represented by letters.

behavior_type

Yes

String

Behavior types:

  • view indicates that an item/content is exposed to users.
  • click indicates that a user clicks an item or content.
  • collect indicates that a user adds an item or content to favorites.
  • uncollect indicates that a user removes an item or content from favorites.
  • search_click indicates that a user clicks an item in the search results.
  • comment indicates that a user makes comments on an item or content.
  • share indicates that a user shares an item/content with others.
  • like indicates that a user gives an item/content a thumb-up.
  • dislike indicates that a user gives an item/content a thumb-down.
  • grade indicates that a user rates an item/content.
  • consume indicates that a user buys an item (primarily refers to commodities).
  • use indicates that a user watches videos/listens to a kind of music/reads something (primarily refers to content)...

threshold

Yes

String

Behavior threshold. Behavior records within the threshold are valid.

Table 6 culstomize_formula parameters

Parameter

Mandatory

Type

Description

alias

Yes

String

Metric alias, which consists of letters, underscores (_), and digits.

formula

Yes

String

Custom metric formula, which consists of the parameter alias and calculation symbols. For example, A/(A+B), where A and B indicate the aliases of custom parameters. The calculation symbols can only be add (+), subtract (-), multiply (x), and divide (/).

Table 7 data_param parameters

Parameter

Mandatory

Type

Description

header

Yes

Boolean

Whether to display the table header

delimiter

Yes

String

Delimiter. The value can contain a maximum of 10 characters.

quote

Yes

String

Quotation character. The value can contain a maximum of 10 characters.

escape

Yes

String

Quotation character. The value can contain a maximum of 10 characters.

Table 8 offline_platform parameters

Parameter

Mandatory

Type

Description

platform

Yes

String

Platform name. The value can be DLI.

platform_parameter

Yes

JSON

Platform parameter. For details, see Table 9.

computing_resource

No

String

Resource specifications required for the normal running of the DLI jobs.

config_load_path

Yes

String

Path to access the configuration items

Table 9 platform_parameter parameters

Parameter

Mandatory

Type

Description

cluster_name

Yes

String

Cluster name. The value can contain a maximum of 64 characters.

cluster_id

No

String

Cluster ID

Response

Table 10 describes the response parameters.

Table 10 Response parameters

Parameter

Type

Description

is_success

Boolean

Whether the request is successful

job_name

String

Job name

job_id

String

Job ID

create_time

Long

Time when a job is created

error_code

String

Error code that indicates a request has failed. This parameter is unavailable when a request is successful.

error_msg

String

Error message that indicates a request has failed. This parameter is unavailable when a request is successful.

Example

  • Example request
    {
        "job_name": "Evaluate-job",
        "job_description": "",
        "data_source": {
            "table_type_id": "GENERAL_FORMAT",
            "data_format": "json",
            "data_source_url": "<Path for storing the data sources>"
        },
        "online_services": [
            "res-test1",
            "res-test2"
        ],
        "indicators": [
            {
                "indicator_name": "clickPVRate",
                "indicator_params": {}
            },
            {
                "indicator_name": "customize",
                "indicator_params": {
                    "customize_parameter": [
                        {
                            "alias": "A",
                            "behavior_type": "click",
                            "threshold": "1"
                        },
                        {
                            "alias": "B",
                            "behavior_type": "click",
                            "threshold": "0.6"
                        },
                        {
                            "alias": "C",
                            "behavior_type": "consume",
                            "threshold": "1"
                        }
                    ],
                    "customize_formula": [
                        {
                            "alias": "indicator1",
                            "formula": "A+B"
                        },
                        {
                            "alias": "indicator2",
                            "formula": "A+B-C"
                        }
                    ]
                }
            }
        ],
        "start_time": "1560960000",
        "end_time": "1561305600",
        "interval": 1,
        "result_path": "<Path for storing the output data>",
        "offline_platform": {
            "platform": "DLI",
            "platform_parameter": {
                "cluster_name": "test",
                "cluster_id": "7f1781ff-438a-40f7-b2b8-8f3f5e464104"
            },
            "config_load_path": "<Path for storing the configuration sources>",
            "computing_resource": ""
        }
    }
  • Example of a successful response
    {
        "is_success": true,
        "job_id": "6b9848b8f2ac4c479855734e354459c1",
        "job_name": "evaluation-job",
        "create_time": "1543978717768"
    }
  • Example of a failed response
    { 
        "is_success": false, 
        "error_code": "res.xxxx", 
        "error_msg": "Failed to submit job." 
    }

Status Code

For details about status codes, see Status Codes.