sendServiceMessage

Used to send Self Service messages through RelayX Network communication for various service calls and data transmission.

Request Parameters

Parameter Name
Type
Required
Description

type

String

Yes

Request protocol type, currently supports HTTP.

content

Object

Yes

Specific request data structure defined by the request type.

content data structure:

Field
Type
Required
Description

method

String

Yes

HTTP method type, optional values: POST, GET, PUT, DELETE.

url

String

Yes

Request URL path.

headers

Object

No

Request headers, JSON format key-value pairs.

data

Object

No

Data in the request body, JSON format.

Response Parameters

Parameter Name
Type
Description

result

Object

Service returned response data structure.

Call Example

example.js
let payload = {
    type: "HTTP",
    content: {
      method: "POST",
      url: "/add",
      headers: {
        "Content-Type": "application/json"
      },
      data: {
        id: "1",
        name: "Alice"
      }
    }
};

let sign = {
  content: "xxxxxx",
  signature: "xxxxxx"
};

const response = await relayx.sendServiceMessage(payload, sign);
if (response.code == 200) {
  console.log("Cross-service result:", response.result);
}