认证授权

获取授权区域

1.接口说明

接口路径:/ac/openapi/v2/center

请求方式:GET

请求数据类型:

接口描述:获取授权区域,返回用户可用区域的信息及url地址、用户集群用户名及家目录等

备注:hpcUrls为作业相关接口调用使用url;efileUrls为文件相应接口调用使用的url;aiUrls为容器相应接口调用使用的url

以上Urls若返回为多组url时,请根据返回中的enable参数进行地址可用性判断,为true时证明url可以正常使用

2.请求消息

请求参数:

Headers:

名称 类型 必填 描述 示例
tokenstring计算区域接口凭证eyJhbGciOiJIUzI1N...

3.请求示例

cURL请求示例

curl --location 'https://api01.xxx.com:65102/ac/openapi/v2/center' \
--header 'Content-Type: application/json' \
--header 'token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJjb21wdXRlVXNlciI6InNsdXJtdGVzdCIsImFjY291bnRTdGF0dXMiOiJUcmlhbCIsImNyZWF0b3IiOiJhYyIsInJvbGUiOiIxIiwiZXhwaXJlVGltZSI6IjE2ODYwMzY3NjA5NTQiLCJjbHVzdGVySWQiOiIxMTExMiIsImludm9rZXIiOiI2MDQ4Y2U3YmExNWMyYWYyZThjZWMxMjk5MWVjMTNjZiIsInVzZXIiOiJzbHVybXRlc3QiLCJ1c2VySWQiOiIxMTY1NTA0ODU0MSJ9.f7nvKA2DqTsXjqF90zblMhwx0zKPpITY0uuSG2ouKG0'

Java请求示例

import okhttp3.*;

public class getAuthorizationCenterInfoDemo {

    public static final String URL = "https://api01.xxx.com:65102/ac/openapi/v2/center";
    public static final String TOKEN = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJjb21wdXRlVXNlciI6InNsdXJtdGVzdCIsImFjY291bnRTdGF0dXMiOiJUcmlhbCIsImNyZWF0b3IiOiJhYyIsInJvbGUiOiIxIiwiZXhwaXJlVGltZSI6IjE2ODY5MDg1MDkyMzEiLCJjbHVzdGVySWQiOiIxMTExMiIsImludm9rZXIiOiI2MDQ4Y2U3YmExNWMyYWYyZThjZWMxMjk5MWVjMTNjZiIsInVzZXIiOiJzbHVybXRlc3QiLCJ1c2VySWQiOiIxMTY1NTA0ODU0MSJ9.U7pZKgO_K6NuRwOWPxblDfgRpGeVxS-BYieOdLhGDK4";

    public static void main(String[] args) throws Exception {
        OkHttpClient client = new OkHttpClient().newBuilder()
                .build();
        Request request = new Request.Builder()
                .url(URL)
                .method("GET", null)
                .addHeader("Content-Type", "application/json")
                .addHeader("token", TOKEN)
                .build();
        Response response = client.newCall(request).execute();
        System.out.println(response.body().string());
    }
}

Python请求示例

import requests
import json

url = "https://api01.xxx.com:65102/ac/openapi/v2/center"

payload = {}
headers = {
  'Content-Type': 'application/json',
  'token': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJjb21wdXRlVXNlciI6InNsdXJtdGVzdCIsImFjY291bnRTdGF0dXMiOiJUcmlhbCIsImNyZWF0b3IiOiJhYyIsInJvbGUiOiIxIiwiZXhwaXJlVGltZSI6IjE2ODYwMzY3NjA5NTQiLCJjbHVzdGVySWQiOiIxMTExMiIsImludm9rZXIiOiI2MDQ4Y2U3YmExNWMyYWYyZThjZWMxMjk5MWVjMTNjZiIsInVzZXIiOiJzbHVybXRlc3QiLCJ1c2VySWQiOiIxMTY1NTA0ODU0MSJ9.f7nvKA2DqTsXjqF90zblMhwx0zKPpITY0uuSG2ouKG0'
}

response = requests.request("GET", url, headers=headers, data=payload)

print(response.text)

4.响应消息

返回参数:

名称 类型 描述 示例
msgstring信息success
codestring状态码0
dataarray区域信息列表
namestring区域名称OpenAPI计算中心
descriptionstring区域描述对外OpenAPI中心
clusterUserInfoobject区域用户信息
idstring区域ID11112
aiUrlsstring容器服务访问信息
efileUrlsstring文件服务访问信息
eshellUrlsstringeshell服务访问信息
hpcUrlsstring作业服务访问信息

返回示例:

{
    "code": "0",
    "msg": "success",
    "data": {
        "id": 11112,
        "name": "OpenAPI计算中心",
        "description": "对外OpenAPI中心",
        "clusterUserInfo": {
            "userName": "test",
            "homePath": "/public/home/test"
         }"ingressUrls": [
            {
                "enable": "true",
                "isManagerNode": "true",
                "version": "5.2.2",
                "url": "https://api01.xxx.com:65106"
            }
        ],
        "efileUrls": [
            {
                "nodeName": "h04r3n07",
                "enable": "true",
                "fastTransEnable": "true",
                "udpPort": "65104",
                "version": "2.6.1",
                "url": "https://api01.xxx.com:65103/efile"
            }
        ],
        "eshellUrls": [
            {
                "enable": "true",
                "version": "2.4.3",
                "url": "https://api01.xxx.com:65106"
            }
        ],
        "hpcUrls": [
            {
                "enable": "true",
                "isManagerNode": "true",
                "version": "5.2.2",
                "url": "https://api01.xxx.com:65106"
            }
        ],
        "aiUrls": [
            {
                "enable": "true",
                "version": "2.4.3",
                "url": "https://api01.xxx.com:65106"
            }
        ]
    }
}

5.错误码

错误码 说明
10001 内部错误
10003 参数不全
10004 参数无效
10008 权限不足
10009 没有权限访问接口
0 接口调用成功

results matching ""

    No results matching ""