RamEx / api.md
zdy10046's picture
deploy RamEx to Hugging Face without binary files
e657e99
|
Raw
History Blame Contribute Delete
35.7 kB
metadata
title: RamEx API v1
language_tabs:
  - python: Python
  - javascript: JavaScript
language_clients:
  - python: ''
  - javascript: ''
toc_footers: []
includes: []
search: true
highlight_theme: darkula
headingLevel: 2

RamEx API v1

Scroll down for code samples, example requests and responses. Select a language for code samples from the tabs above or the mobile navigation menu.

RamEx拉曼光谱分析系统API文档

Base URLs:

Terms of service Email: Support License: BSD License

Authentication

  • HTTP Authentication, scheme: basic

projects

projects_list

Code samples

import requests
headers = {
  'Accept': 'application/json'
}

r = requests.get('http://localhost:8080/api/projects/', headers = headers)

print(r.json())

const headers = {
  'Accept':'application/json'
};

fetch('http://localhost:8080/api/projects/',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

GET /projects/

项目视图集

Example responses

200 Response

[
  {
    "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
    "name": "string",
    "created_at": "2019-08-24T14:15:22Z",
    "last_modified": "2019-08-24T14:15:22Z",
    "status": "initialized"
  }
]

Responses

Status Meaning Description Schema
200 OK none Inline

Response Schema

Status Code 200

Name Type Required Restrictions Description
anonymous [Project] false none none
» id string(uuid) false read-only none
» name string true none none
» created_at string(date-time) false read-only none
» last_modified string(date-time) false read-only none
» status string false read-only none

Enumerated Values

Property Value
status initialized
status data_loaded
status preprocessing
status preprocessing_completed
status analysis
status completed
status error

projects_create

Code samples

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

r = requests.post('http://localhost:8080/api/projects/', headers = headers)

print(r.json())
const inputBody = '{
  "name": "string"
}';
const headers = {
  'Content-Type':'application/json',
  'Accept':'application/json'
};

fetch('http://localhost:8080/api/projects/',
{
  method: 'POST',
  body: inputBody,
  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

POST /projects/

项目视图集

Body parameter

{
  "name": "string"
}

Parameters

Name In Type Required Description
body body Project true none

Example responses

201 Response

{
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "name": "string",
  "created_at": "2019-08-24T14:15:22Z",
  "last_modified": "2019-08-24T14:15:22Z",
  "status": "initialized"
}

Responses

Status Meaning Description Schema
201 Created none Project

projects_read

Code samples

import requests
headers = {
  'Accept': 'application/json'
}

r = requests.get('http://localhost:8080/api/projects/{id}/', headers = headers)

print(r.json())

const headers = {
  'Accept':'application/json'
};

fetch('http://localhost:8080/api/projects/{id}/',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

GET /projects/{id}/

项目视图集

Parameters

Name In Type Required Description
id path string(uuid) true A UUID string identifying this 项目.

Example responses

200 Response

{
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "name": "string",
  "description": "string",
  "created_at": "2019-08-24T14:15:22Z",
  "last_modified": "2019-08-24T14:15:22Z",
  "status": "initialized",
  "data_files": [
    {
      "id": 0,
      "filename": "string",
      "uploaded_at": "2019-08-24T14:15:22Z",
      "wavenumber_min": 0,
      "wavenumber_max": 0
    }
  ],
  "active_data_file": {
    "id": 0,
    "filename": "string",
    "uploaded_at": "2019-08-24T14:15:22Z",
    "wavenumber_min": 0,
    "wavenumber_max": 0
  },
  "data_files_count": "string"
}

Responses

Status Meaning Description Schema
200 OK none ProjectDetail

projects_update

Code samples

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

r = requests.put('http://localhost:8080/api/projects/{id}/', headers = headers)

print(r.json())
const inputBody = '{
  "name": "string"
}';
const headers = {
  'Content-Type':'application/json',
  'Accept':'application/json'
};

fetch('http://localhost:8080/api/projects/{id}/',
{
  method: 'PUT',
  body: inputBody,
  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

PUT /projects/{id}/

项目视图集

Body parameter

{
  "name": "string"
}

Parameters

Name In Type Required Description
body body Project true none
id path string(uuid) true A UUID string identifying this 项目.

Example responses

200 Response

{
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "name": "string",
  "created_at": "2019-08-24T14:15:22Z",
  "last_modified": "2019-08-24T14:15:22Z",
  "status": "initialized"
}

Responses

Status Meaning Description Schema
200 OK none Project

projects_partial_update

Code samples

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

r = requests.patch('http://localhost:8080/api/projects/{id}/', headers = headers)

print(r.json())
const inputBody = '{
  "name": "string"
}';
const headers = {
  'Content-Type':'application/json',
  'Accept':'application/json'
};

fetch('http://localhost:8080/api/projects/{id}/',
{
  method: 'PATCH',
  body: inputBody,
  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

PATCH /projects/{id}/

项目视图集

Body parameter

{
  "name": "string"
}

Parameters

Name In Type Required Description
body body Project true none
id path string(uuid) true A UUID string identifying this 项目.

Example responses

200 Response

{
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "name": "string",
  "created_at": "2019-08-24T14:15:22Z",
  "last_modified": "2019-08-24T14:15:22Z",
  "status": "initialized"
}

Responses

Status Meaning Description Schema
200 OK none Project

projects_delete

Code samples

import requests

r = requests.delete('http://localhost:8080/api/projects/{id}/')

print(r.json())

fetch('http://localhost:8080/api/projects/{id}/',
{
  method: 'DELETE'

})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

DELETE /projects/{id}/

删除项目,包括其关联的所有文件和数据

Parameters

Name In Type Required Description
id path string(uuid) true A UUID string identifying this 项目.

Responses

Status Meaning Description Schema
204 No Content none None

projects_data_group_info_list

Code samples

import requests

r = requests.get('http://localhost:8080/api/projects/{project_id}/data/group_info/')

print(r.json())

fetch('http://localhost:8080/api/projects/{project_id}/data/group_info/',
{
  method: 'GET'

})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

GET /projects/{project_id}/data/group_info/

获取分组信息视图

Parameters

Name In Type Required Description
project_id path string true none

Responses

Status Meaning Description Schema
200 OK none None

projects_data_save_rds_create

Code samples

import requests

r = requests.post('http://localhost:8080/api/projects/{project_id}/data/save_rds/')

print(r.json())

fetch('http://localhost:8080/api/projects/{project_id}/data/save_rds/',
{
  method: 'POST'

})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

POST /projects/{project_id}/data/save_rds/

保存确认的RDS数据视图

Parameters

Name In Type Required Description
project_id path string true none

Responses

Status Meaning Description Schema
201 Created none None

projects_data_upload_create

Code samples

import requests

r = requests.post('http://localhost:8080/api/projects/{project_id}/data/upload/')

print(r.json())

fetch('http://localhost:8080/api/projects/{project_id}/data/upload/',
{
  method: 'POST'

})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

POST /projects/{project_id}/data/upload/

数据上传视图

Parameters

Name In Type Required Description
project_id path string true none

Responses

Status Meaning Description Schema
201 Created none None

projects_data_delete_delete

Code samples

import requests

r = requests.delete('http://localhost:8080/api/projects/{project_id}/data/{file_id}/delete/')

print(r.json())

fetch('http://localhost:8080/api/projects/{project_id}/data/{file_id}/delete/',
{
  method: 'DELETE'

})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

DELETE /projects/{project_id}/data/{file_id}/delete/

删除数据文件视图

Parameters

Name In Type Required Description
project_id path string true none
file_id path string true none

Responses

Status Meaning Description Schema
204 No Content none None

projects_data_select_create

Code samples

import requests

r = requests.post('http://localhost:8080/api/projects/{project_id}/data/{file_id}/select/')

print(r.json())

fetch('http://localhost:8080/api/projects/{project_id}/data/{file_id}/select/',
{
  method: 'POST'

})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

POST /projects/{project_id}/data/{file_id}/select/

选择活动数据文件视图

Parameters

Name In Type Required Description
project_id path string true none
file_id path string true none

Responses

Status Meaning Description Schema
201 Created none None

projects_data_update_create

Code samples

import requests

r = requests.post('http://localhost:8080/api/projects/{project_id}/data/{file_id}/update/')

print(r.json())

fetch('http://localhost:8080/api/projects/{project_id}/data/{file_id}/update/',
{
  method: 'POST'

})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

POST /projects/{project_id}/data/{file_id}/update/

更新数据文件视图

Parameters

Name In Type Required Description
project_id path string true none
file_id path string true none

Responses

Status Meaning Description Schema
201 Created none None

projects_meta-based_create

Code samples

import requests

r = requests.post('http://localhost:8080/api/projects/{project_id}/meta-based/')

print(r.json())

fetch('http://localhost:8080/api/projects/{project_id}/meta-based/',
{
  method: 'POST'

})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

POST /projects/{project_id}/meta-based/

基于元数据分析任务视图

Parameters

Name In Type Required Description
project_id path string true none

Responses

Status Meaning Description Schema
201 Created none None

projects_meta-based_export_list

Code samples

import requests

r = requests.get('http://localhost:8080/api/projects/{project_id}/meta-based/export/')

print(r.json())

fetch('http://localhost:8080/api/projects/{project_id}/meta-based/export/',
{
  method: 'GET'

})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

GET /projects/{project_id}/meta-based/export/

基于元数据分析结果导出视图

Parameters

Name In Type Required Description
project_id path string true none

Responses

Status Meaning Description Schema
200 OK none None

projects_meta-based_results_list

Code samples

import requests

r = requests.get('http://localhost:8080/api/projects/{project_id}/meta-based/results/')

print(r.json())

fetch('http://localhost:8080/api/projects/{project_id}/meta-based/results/',
{
  method: 'GET'

})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

GET /projects/{project_id}/meta-based/results/

基于元数据分析结果视图

Parameters

Name In Type Required Description
project_id path string true none

Responses

Status Meaning Description Schema
200 OK none None

projects_meta-based_status_list

Code samples

import requests

r = requests.get('http://localhost:8080/api/projects/{project_id}/meta-based/status/')

print(r.json())

fetch('http://localhost:8080/api/projects/{project_id}/meta-based/status/',
{
  method: 'GET'

})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

GET /projects/{project_id}/meta-based/status/

基于元数据分析状态视图

Parameters

Name In Type Required Description
project_id path string true none

Responses

Status Meaning Description Schema
200 OK none None

projects_meta-free_create

Code samples

import requests

r = requests.post('http://localhost:8080/api/projects/{project_id}/meta-free/')

print(r.json())

fetch('http://localhost:8080/api/projects/{project_id}/meta-free/',
{
  method: 'POST'

})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

POST /projects/{project_id}/meta-free/

无元数据分析任务视图

Parameters

Name In Type Required Description
project_id path string true none

Responses

Status Meaning Description Schema
201 Created none None

projects_meta-free_export_list

Code samples

import requests

r = requests.get('http://localhost:8080/api/projects/{project_id}/meta-free/export/')

print(r.json())

fetch('http://localhost:8080/api/projects/{project_id}/meta-free/export/',
{
  method: 'GET'

})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

GET /projects/{project_id}/meta-free/export/

无元数据分析结果导出视图

Parameters

Name In Type Required Description
project_id path string true none

Responses

Status Meaning Description Schema
200 OK none None

projects_meta-free_results_list

Code samples

import requests

r = requests.get('http://localhost:8080/api/projects/{project_id}/meta-free/results/')

print(r.json())

fetch('http://localhost:8080/api/projects/{project_id}/meta-free/results/',
{
  method: 'GET'

})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

GET /projects/{project_id}/meta-free/results/

无元数据分析结果视图

Parameters

Name In Type Required Description
project_id path string true none

Responses

Status Meaning Description Schema
200 OK none None

projects_meta-free_status_list

Code samples

import requests

r = requests.get('http://localhost:8080/api/projects/{project_id}/meta-free/status/')

print(r.json())

fetch('http://localhost:8080/api/projects/{project_id}/meta-free/status/',
{
  method: 'GET'

})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

GET /projects/{project_id}/meta-free/status/

无元数据分析状态视图

Parameters

Name In Type Required Description
project_id path string true none

Responses

Status Meaning Description Schema
200 OK none None

projects_preprocessing_create

Code samples

import requests

r = requests.post('http://localhost:8080/api/projects/{project_id}/preprocessing/')

print(r.json())

fetch('http://localhost:8080/api/projects/{project_id}/preprocessing/',
{
  method: 'POST'

})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

POST /projects/{project_id}/preprocessing/

预处理任务视图

Parameters

Name In Type Required Description
project_id path string true none

Responses

Status Meaning Description Schema
201 Created none None

projects_preprocessing_export_list

Code samples

import requests

r = requests.get('http://localhost:8080/api/projects/{project_id}/preprocessing/export/')

print(r.json())

fetch('http://localhost:8080/api/projects/{project_id}/preprocessing/export/',
{
  method: 'GET'

})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

GET /projects/{project_id}/preprocessing/export/

预处理数据导出视图

Parameters

Name In Type Required Description
project_id path string true none

Responses

Status Meaning Description Schema
200 OK none None

projects_preprocessing_status_list

Code samples

import requests

r = requests.get('http://localhost:8080/api/projects/{project_id}/preprocessing/status/')

print(r.json())

fetch('http://localhost:8080/api/projects/{project_id}/preprocessing/status/',
{
  method: 'GET'

})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

GET /projects/{project_id}/preprocessing/status/

预处理状态视图

Parameters

Name In Type Required Description
project_id path string true none

Responses

Status Meaning Description Schema
200 OK none None

projects_results_export_create

Code samples

import requests

r = requests.post('http://localhost:8080/api/projects/{project_id}/results/export/')

print(r.json())

fetch('http://localhost:8080/api/projects/{project_id}/results/export/',
{
  method: 'POST'

})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

POST /projects/{project_id}/results/export/

导出结果视图

Parameters

Name In Type Required Description
project_id path string true none

Responses

Status Meaning Description Schema
201 Created none None

projects_results_export_read

Code samples

import requests

r = requests.get('http://localhost:8080/api/projects/{project_id}/results/export/{export_id}/')

print(r.json())

fetch('http://localhost:8080/api/projects/{project_id}/results/export/{export_id}/',
{
  method: 'GET'

})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

GET /projects/{project_id}/results/export/{export_id}/

导出状态视图

Parameters

Name In Type Required Description
project_id path string true none
export_id path string true none

Responses

Status Meaning Description Schema
200 OK none None

projects_results_summary_list

Code samples

import requests

r = requests.get('http://localhost:8080/api/projects/{project_id}/results/summary/')

print(r.json())

fetch('http://localhost:8080/api/projects/{project_id}/results/summary/',
{
  method: 'GET'

})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

GET /projects/{project_id}/results/summary/

结果摘要视图

Parameters

Name In Type Required Description
project_id path string true none

Responses

Status Meaning Description Schema
200 OK none None

token

token_validate_list

Code samples

import requests

r = requests.get('http://localhost:8080/api/token/validate/')

print(r.json())

fetch('http://localhost:8080/api/token/validate/',
{
  method: 'GET'

})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

GET /token/validate/

GET方法也支持Token验证(通过URL参数)

Responses

Status Meaning Description Schema
200 OK none None

验证Token

Code samples

import requests

r = requests.post('http://localhost:8080/api/token/validate/')

print(r.json())

fetch('http://localhost:8080/api/token/validate/',
{
  method: 'POST'

})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

POST /token/validate/

支持的参数传递方式:

  1. JSON: {"token": "your_token"}
  2. Form data: token=your_token
  3. URL参数: ?token=your_token
  4. Header: Authorization: Token your_token

Responses

Status Meaning Description Schema
201 Created none None

user

user_info_list

Code samples

import requests

r = requests.get('http://localhost:8080/api/user/info/')

print(r.json())

fetch('http://localhost:8080/api/user/info/',
{
  method: 'GET'

})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

GET /user/info/

获取当前用户信息

Responses

Status Meaning Description Schema
200 OK none None

Schemas

Project

{
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "name": "string",
  "created_at": "2019-08-24T14:15:22Z",
  "last_modified": "2019-08-24T14:15:22Z",
  "status": "initialized"
}

Properties

Name Type Required Restrictions Description
id string(uuid) false read-only none
name string true none none
created_at string(date-time) false read-only none
last_modified string(date-time) false read-only none
status string false read-only none

Enumerated Values

Property Value
status initialized
status data_loaded
status preprocessing
status preprocessing_completed
status analysis
status completed
status error

DataFile

{
  "id": 0,
  "filename": "string",
  "uploaded_at": "2019-08-24T14:15:22Z",
  "wavenumber_min": 0,
  "wavenumber_max": 0
}

Properties

Name Type Required Restrictions Description
id integer false read-only none
filename string false read-only none
uploaded_at string(date-time) false read-only none
wavenumber_min number¦null false none none
wavenumber_max number¦null false none none

ProjectDetail

{
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "name": "string",
  "description": "string",
  "created_at": "2019-08-24T14:15:22Z",
  "last_modified": "2019-08-24T14:15:22Z",
  "status": "initialized",
  "data_files": [
    {
      "id": 0,
      "filename": "string",
      "uploaded_at": "2019-08-24T14:15:22Z",
      "wavenumber_min": 0,
      "wavenumber_max": 0
    }
  ],
  "active_data_file": {
    "id": 0,
    "filename": "string",
    "uploaded_at": "2019-08-24T14:15:22Z",
    "wavenumber_min": 0,
    "wavenumber_max": 0
  },
  "data_files_count": "string"
}

Properties

Name Type Required Restrictions Description
id string(uuid) false read-only none
name string true none none
description string false none none
created_at string(date-time) false read-only none
last_modified string(date-time) false read-only none
status string false read-only none
data_files [DataFile] false read-only none
active_data_file DataFile false none none
data_files_count string false read-only none

Enumerated Values

Property Value
status initialized
status data_loaded
status preprocessing
status preprocessing_completed
status analysis
status completed
status error