Skip to main content
Version: 2.6.1

A multilingual HTTP client

Description#

  • This document focuses on how to access gateways for HTTP services in other languages.
  • To access the gateway, you need to get the token first, and then you can call the registration service or metadata interface according to your needs.

Get token#

  • Request Method

    GET

  • Request Path

    • http://{shenyu-admin}/platform/login
    • Where shenyu-admin is the ip + port of the admin backend management system.
  • Request Params

    • query parameter, the account password is the username and password of the admin service.

      FieldTypeRequiredDesc
      userNameStringYesshenyu admin account
      passwordStringYesshenyu admin password
  • Return Data

    FieldTypeDesc
    codeIntegerReturn code
    messageStringReturn message
    dataObjectReturn data
    idIntegeruser id
    userNameStringaccount
    roleIntegerrole id
    enabledBooleanstatus
    dateCreatedStringcreate time
    dateUpdatedStringupdate time
    tokenStringtoken
    expiredTimeLongtimeout time, in milliseconds

    Example

    {    "code": 200,    "message": "login dashboard user success",    "data": {        "id": "1",        "userName": "admin",        "role": 1,        "enabled": true,        "dateCreated": "2022-09-07 22:08:23",        "dateUpdated": "2022-09-07 22:08:23",        "token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyTmFtZSI6ImFkbWluIiwiZXhwIjoxNjYyNjQ2MzU5fQ.WBXBgCcGsnnC00pRbDOtqCVoAaZr8MKH6WE6kY-NGaI",        "expiredTime": 86400000    }}

Registration Services#

  • Request Method

    POST

  • Request Path

    • http://{shenyu-admin}/shenyu-client/register-uri
    • Where shenyu-admin is the ip + port of the admin backend management system.
  • Request Params

    • Header

      • contentType: application/json

      • X-Access-Token: {token},token is the token obtained by Get token.

    • Bodyjson format

      FieldTypeRequiredDesc
      protocolStringYesprotocol type
      appNameStringYesapp name
      contextPathStringYesservice path
      rpcTypeStringYesrpc type, supported type reference RpcTypeEnum
      hostStringYesservice IP
      portIntegerYesservice port
      eventTypeStringYesevent type, supported types reference EventType

      Example

      {    "protocol": "http",    "appName": "app",    "contextPath": "/test",    "rpcType": "http",    "host": "127.0.0.1",    "port": "8080",    "eventType": "REGISTER"}
  • Return Data

    A successful registration returns success.

Registration Metadata#

  • Request Method

    POST

  • Request Path

    • http://{shenyu-admin}/shenyu-client/register-metadata
    • Where shenyu-admin is the ip + port of the admin backend management system.
  • Request Params

    • Header

      • contentType: application/json

      • X-Access-Token: {token},token is the token obtained by Get token.

    • Bodyjson format.

      FieldTypeRequiredDesc
      appNameStringYesapp name
      contextPathStringYesservice path
      pathStringYespath
      pathDescStringYespath description
      rpcTypeStringYesrpc type, supported type reference RpcTypeEnum
      serviceNameStringYesservice name
      methodNameStringYesmethod name
      ruleNameStringYesrule name
      parameterTypesStringYesparameter Type
      rpcExtStringYesrpc expansion parameters
      enabledBooleanNostatus
      hostStringYesservice IP
      portIntegerYesservice port
      pluginNamesListNoplugin name list
      registerMetaDataBooleanNowhether to register metadata

      examples

      {    "appName": "app",    "contextPath": "/",    "path": "/test",    "rpcType": "http",    "serviceName": "test service",    "parameterTypes": "java.lang.String",    "pathDesc": "test path",    "methodName": "test method",    "ruleName": "test rule",    "rpcExt": "{\"loadbalance\":\"hash\",\"retries\":3,\"timeout\":-1}",    "enabled": true,    "host": "127.0.0.1",    "port": 8080,    "pluginNames": [],    "registerMetaData": true}
  • Return Data

    A successful registration returns success.