Updated on 2024-04-08 GMT+08:00

Modifying a Transaction

Function

This API is used to modify a transaction

URI

PUT /v1/{project_id}/templates/{template_id}

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

template_id

Yes

Integer

Transaction ID.

Minimum: 0

Maximum: 2147483647

project_id

Yes

String

Project ID. For details, see Obtaining a Project ID.

Minimum: 0

Maximum: 64

Request Parameters

Table 2 Request body parameters

Parameter

Mandatory

Type

Description

id

Yes

Integer

Transaction ID.

Minimum: 0

Maximum: 2147483647

project_id

Yes

Integer

Project ID.

Minimum: 0

Maximum: 2147483647

name

Yes

String

Transaction name.

Minimum: 1

Maximum: 42

temp_type

No

Integer

Transaction type.

Minimum: 0

Maximum: 2147483647

description

No

String

Description.

Minimum: 0

Maximum: 1024

for_loop_params

No

Array of objects

Logic controller field of the old edition. This parameter is not used in the current edition.

Array Length: 0 - 1024

enable_pre

No

Boolean

Whether to enable the preset transaction. This parameter is not used in the current edition.

contents

No

Array of TempContentInfo objects

Transaction script information.

Array Length: 0 - 1024

Table 3 TempContentInfo

Parameter

Mandatory

Type

Description

content_id

No

Integer

Packet ID, transaction ID, or plug-in ID.

Minimum: 0

Maximum: 2147483647

content

No

Array of Content objects

Content.

Array Length: 0 - 1000

index

No

Integer

Index.

Minimum: 0

Maximum: 2147483647

data

No

Object

Data instruction content.

data_type

No

Integer

Data instruction type (0: default request card; 1: data instruction; 201: loop instruction; 202: condition instruction; 203: VU percentage controller; 204: throughput controller; 301: rendezvous point; 302: plug-in request).

Minimum: 0

Maximum: 2147483647

Table 4 Content

Parameter

Mandatory

Type

Description

content_type

No

Integer

Case card type (1: think time; 2: packet; 3: checkpoint; 4: variable extraction).

Minimum: 0

Maximum: 2147483647

content

No

ContentInfo object

Content.

Table 5 ContentInfo

Parameter

Mandatory

Type

Description

body_type

No

Integer

Body type (0: string; 1: form-data format; 3: x-www-form-urlencoded format).

Minimum: 0

Maximum: 2147483647

bodys

No

Array of objects

bodys

check_end_length

No

Object

Length of the data returned through TCP/UDP.

check_end_str

No

Object

End character returned through TCP/UDP.

check_end_type

No

Object

End type (1: data length; 2: end character) returned through TCP/UDP.

connect_timeout

No

Integer

Timeout duration.

Minimum: 0

Maximum: 2147483647

connect_type

No

Integer

Connection settings. This parameter is not used in the current edition.

Minimum: 0

Maximum: 2147483647

headers

No

Array of ContentHeader objects

Request header.

Array Length: 0 - 1024

http_version

No

String

HTTP version.

Minimum: 0

Maximum: 1024

method

No

String

HTTP method.

Minimum: 0

Maximum: 1024

name

No

String

Case name.

Minimum: 0

Maximum: 1024

protocol_type

No

Integer

Protocol type (1: HTTP; 2: HTTPS; 3: TCP; 4: UDP; 7: HLS/RTMP; 9: WebSocket; 10: HTTP-FLV).

Minimum: 0

Maximum: 2147483647

return_timeout

No

Integer

Response timeout.

Minimum: 0

Maximum: 2147483647

return_timeout_param

No

String

Response timeout parameter.

Minimum: 0

Maximum: 40960

url

No

String

Request URL.

Minimum: 0

Maximum: 40960

rtmp_url

No

String

RTMP address.

Minimum: 0

Maximum: 40960

flv_url

No

String

FLV address.

Minimum: 0

Maximum: 40960

bitrate_type

No

Integer

Resolution policy.

Minimum: 0

Maximum: 128

duration

No

Integer

Duration.

Minimum: 0

Maximum: 2147483647

retry_delay

No

Integer

HLS retry delay.

Minimum: 0

Maximum: 2147483647

retry_time

No

Integer

HLS retries.

Minimum: 0

Maximum: 2147483647

Table 6 ContentHeader

Parameter

Mandatory

Type

Description

key

No

String

Key.

Minimum: 0

Maximum: 40960

value

No

String

Value.

Minimum: 0

Maximum: 40960

Response Parameters

None

Example Requests

Modifying the transaction whose ID is 1 and its request information. The ID of the project to which the transaction belongs is 1.

/v1/{project_id}/templates/1

{
  "contents" : [ {
    "content" : [ {
      "content" : {
        "body_type" : 0,
        "bodys" : [ ],
        "check_end_length" : null,
        "check_end_str" : null,
        "check_end_type" : null,
        "connect_timeout" : 5000,
        "connect_type" : 1,
        "headers" : [ {
          "key" : "Content-Type",
          "value" : "application/json"
        } ],
        "http_version" : "HTTP/1.1",
        "method" : "GET",
        "name" : "Msg-31445",
        "protocol_type" : 2,
        "return_timeout" : 5000,
        "return_timeout_param" : null,
        "url" : "https://www.domain-example.com"
      },
      "content_type" : 2
    } ],
    "content_id" : 2346,
    "index" : 0
  } ],
  "description" : "",
  "enable_pre" : false,
  "for_loop_params" : [ ],
  "id" : 1,
  "name" : "transaction_test",
  "project_id" : 1,
  "temp_type" : 0
}

Example Responses

None

Status Codes

Status Code

Description

204

success

501

unknown error

Error Codes

See Error Codes.