Skip to content

Portal beckend API Doc

Clement Li edited this page Mar 28, 2022 · 9 revisions

1. Config

baseUrl : You can customize your own server baseUrl

Module 1 : License

2.1 List all the dataset licenses

Request URL:

  • http://{baseUrl:Port}/api/v1/data-license Request Method:

  • GET application/json Request Params:

Param Optional Type Tips
type NO int 0:all,1:Data License,2:Data-Specific License,3:DataSource Terms of Use
pageNum NO int The page number requested
pageSize NO int The total number of the pages
token NO string access token

Request Cases

{
	"pageNum":2,
    "pageSize":1
}

Return Cases

  {
	"totalNum":100,
    "totalPage":9,
    "data":[
    {
      "id" : 1,
      “license_name”:"MIT",
      xxxxx
      
    },{
      "id" : 2,
      “license_name”:"CC BY-SA 4.0",
      xxxxx
    }
    ]
  }
 

2.2 Get basic info of dataset license by ID

Request URL:

  • http://{baseUrl:Port}}/api/v1/get_license_basic_by_id Request Method:

  • GET application/json Request Params:

Param Optional Type Tips
id NO int id
token NO string access token

Request Cases

{
	"id":2
}

Return Cases

 {
    "data": {
        "id": 1,
        "license_name": "MIT License",
        "license_type": "License",
        "osi_approved": "Yes",
        "short_identifier": "MIT"
    },
    "status": "success"
}
 

2.3 Get basic info of dataset license by Name

Request URL:

  • http://{baseUrl:Port}}/api/v1/get_license_basic_by_name Request Method:

  • GET application/json Request Params:

Param Optional Type Tips
name NO int license name
token NO string access token

Request Cases

{
	"name":"MIT License"
}

Return Cases

 {
    "data": {
        "id": 1,
        "license_name": "MIT License",
        "license_type": "License",
        "osi_approved": "Yes",
        "short_identifier": "MIT"
    },
    "status": "success"
}
 

2.4 Search basic info of dataset license by Name

Request URL:

  • http://{baseUrl:Port}}/api/v1/search_license_basic_by_name Request Method:

  • GET application/json Request Params:

Param Optional Type Tips
name NO int license name
type NO int 0:all,1:Data License,2:Data-Specific License,3:DataSource Terms of Use
token NO string access token

Request Cases

{
	"name":"MIT License"
}

Return Cases

 {
    "data": {
        "id": 1,
        "license_name": "MIT License",
        "license_type": "License",
        "osi_approved": "Yes",
        "short_identifier": "MIT"
    },
    "status": "success"
}
 

2.5 Get data info of dataset license by ID

Request URL:

  • http://{baseUrl:Port}}/api/v1/get_license_data_by_id Request Method:

  • GET application/json Request Params:

Param Optional Type Tips
id NO int license_id
token NO string access token

Request Cases

{
	"id":1
}

Return Cases

  {
    "can":[
    {
      "id" : 1,
      “property”:"Access"
    },{
      "id" : 2,
      “property”:"Modification"
    }
    ]
    "cannot":[
    {
      "id" : 1,
      “property”:"Access"
    },{
      "id" : 2,
      “property”:"Modification"
    }
    ]
    "obligation":[
    {
      "id" : 1,
      “property”:"Access"
    },{
      "id" : 2,
      “property”:"Modification"
    }
    ]
    "limitation":[
    {
      "id" : 1,
      “property”:"Access"
    },{
      "id" : 2,
      “property”:"Modification"
    }
    ]
  }
 

2.6 Get model info of dataset license by ID

Request URL:

  • http://{baseUrl:Port}}/api/v1/get_license_model_by_id Request Method:

  • GET application/json Request Params:

Param Optional Type Tips
id NO int license_id
token NO string access token

Request Cases

{
	"id":1
}

Return Cases

  {
    "can":[
    {
      "id" : 1,
      “property”:"Access"
    },{
      "id" : 2,
      “property”:"Modification"
    }
    ]
    "cannot":[
    {
      "id" : 1,
      “property”:"Access"
    },{
      "id" : 2,
      “property”:"Modification"
    }
    ]
    "obligation":[
    {
      "id" : 1,
      “property”:"Access"
    },{
      "id" : 2,
      “property”:"Modification"
    }
    ]
    "limitation":[
    {
      "id" : 1,
      “property”:"Access"
    },{
      "id" : 2,
      “property”:"Modification"
    }
    ]
  }
 

2.7 Get other info of dataset license by ID

Request URL:

  • http://{baseUrl:Port}}/api/v1/get_license_other_by_id Request Method:

  • GET application/json Request Params:

Param Optional Type Tips
id NO int license_id
token NO string access token

Request Cases

{
	"id":1
}

Return Cases

  {
    "data":[
    {
      "id" : 1,
      “property”:"Credit"
      "value":xxxxxx
    }
    {
      "id" : 2,
      “property”:"license_validity"
      "value":xxxxxx
    }
    {
      "id" : 3,
      “property”:"Credit"
      "value":xxxxxx
    }
    {
      "id" : 4,
      “property”:"Credit"
      "value":xxxxxx
    }
    ]
  }
 

2.8 Add license info

Request URL:

  • http://{baseUrl:Port}}/api/v1/add_datalicense

Request Method:

  • POST application/json Request Params:
Param Optional Type Tips
data NO json dataset_name
token NO string access token

Request Cases

 "data":{
 [{  
      “license_name”:"FFHQ",
      "license_type":"MIT"
      "short_identifier":xxxxxx
      xxxxxx
  },
  {  
      “license_name”:"FFHQ",
      "license_type":"MIT"
      "short_identifier":xxxxxx
      xxxxxx
  }]
}

Return Cases

  {
    "affectedRow":"20",
    "result":"success",
     "data":{
      “license_name”:"FFHQ",
      "license_type":"MIT"
      "short_identifier":xxxxxx
      xxxxxx
  }
  }
 

Module 2 : Dataset

3.1 List all the metadata of datasets

Request URL:

  • http://{baseUrl:Port}}/api/v1/dataset Request Method:

  • GET application/json Request Params:

Param Optional Type Tips
pageNum NO int The page will be displayed
pageSize NO int how many items in one page
token NO string access token

Request Cases

{
    "pageNum":2,
    "pageSize":1
}

Return Cases

  {
	"totalNum":100
    "totalPage":9
    "data":[
    {
      "id" : 1,
      “dataset_name”:"FFHQ",
      xxxxx
      
    },{
      "id" : 2,
      “dataset_name”:"cityscape",
      xxxxx
    }
    ]
  }
 

3.2 Get metadata of dataset license by ID

Request URL:

  • http://{baseUrl:Port}}/api/v1/get_dataset_by_id Request Method:

  • GET application/json Request Params:

Param Optional Type Tips
id NO int dataset_id
token NO string access token

Request Cases

{
    "id":1
}

Return Cases

  {
    "data":[
    {
      "id" : 1,
      “dataset_name”:"FFHQ",
      "dataset_license":"MIT"
      "dataset_license_from":xxxxxx
      xxxxxx
    }
  }
 

3.3 Get metadata of dataset license by Name

Request URL:

  • http://{baseUrl:Port}}/api/v1/get_dataset_by_name Request Method:

  • GET application/json Request Params:

Param Optional Type Tips
name NO text dataset_name
token NO string access token

Request Cases

{
	"name":"FFHQ"
}

Return Cases

  {
    "data":[
    {
      "id" : 1,
      “dataset_name”:"FFHQ",
      "dataset_license":"MIT"
      "dataset_license_from":xxxxxx
      xxxxxx
    }
  }
  }
 

3.4 Search metadata of dataset license by Name

Request URL:

  • http://{baseUrl:Port}}/api/v1/search_dataset_by_name Request Method:

  • GET application/json Request Params:

Param Optional Type Tips
name NO text dataset_name
token NO string access token

Request Cases

{
	"name":"FFHQ"
}

Return Cases

  {
    "data":[
    {
      "id" : 1,
      “dataset_name”:"FFHQ",
      "dataset_license":"MIT"
      "dataset_license_from":xxxxxx
      xxxxxx
    }
  }
  }
 

3.5 Get index of dataset license

Request URL:

  • http://{baseUrl:Port}}/api/v1/get_license_index Request Method:

  • GET application/json Request Params:

Param Optional Type Tips
token NO string access token
type NO int 0:all,1:license,2:Data-Specific-License,3:DataSource Terms of Use

Request Cases

{
}

Return Cases

  {
    "data":[
    {
      "id" : 1,
      “license_name”:"MIT",
    }
  }
  }
 

3.6 Get index of dataset

Request URL:

  • http://{baseUrl:Port}}/api/v1/get_dataset_index Request Method:

  • GET application/json Request Params:

Param Optional Type Tips
token NO string access token

Request Cases

{
}

Return Cases

  {
    "data":[
    {
      "id" : 1,
      “dataset_name”:"FFHQ",
    }
  }
  }
 

3.7 Add Dataset metadata

Request URL:

  • http://{baseUrl:Port}}/api/v1/add_dataset

Request Method:

  • POST application/json Request Params:
Param Optional Type Tips
data NO json dataset_name
token NO string access token

Request Cases

 "data":{
 [{  
      “dataset_name”:"FFHQ",
      "dataset_license":"MIT"
      "dataset_license_from":xxxxxx
      xxxxxx
  },
  {  
      “dataset_name”:"FFHQ",
      "dataset_license":"MIT"
      "dataset_license_from":xxxxxx
      xxxxxx
  }]
}

Return Cases

  {
    "affectedRow":"20",
    "result":"success",
     "data":{
      “dataset_name”:"FFHQ",
      "dataset_license":"MIT"
      "dataset_license_from":xxxxxx
      xxxxxx
  }
  }