Skip to content

API v1 Document (stop updated)

Chihjen Ko edited this page May 18, 2019 · 3 revisions

Base URI

http://52.192.70.91/api/v1

Status Code

  • 200 成功。
  • 204 成功且不回覆內容,用於回覆 cross site access 的 OPTIONS request,以及 DELETE request。
  • 400 表單驗證失敗,前端必須在發送前驗證使用者的輸入,後端返回訊息僅供開發使用。
  • 401 未登入,前端可顯示需登入提示或直接轉跳到 oauthUrl 進行登入。
  • 403 已登入,但仍然沒有權限,如存取自己沒有權限的計畫,或用計畫執行者權限編輯常見物種...等。
  • 404 找不到,網址錯誤或資源不存在。
  • 500 後端發生錯誤。

Time Format

資料傳輸一律使用 ISO 8601 UTC 時區 2019-01-01T00:00:00.000Z
僅 CSV 匯出、匯入時使用設定檔的預設時區 GMT+8。

Location

經緯度前端空間資訊呈現僅使用 WGS84,故資料來源需要注意原始大地基準,若為 TWD97 則應該在提供給前端時轉換為 WGS84。
請尋找類似的程式:https://github.com/yichunsung/trans97.js

APIs

GET /config

Get system config.

auth

Anonymous can access.

response

Field Type Note
languages Object 目前支援的語系
oauthUrl string 登入網址,前端將瀏覽器轉跳到此網址讓使用者進行登入程序。
登入完成後使用者會導回前端網址,前端網址在camera-trap-credentials設定

example

{
  "languages": {
    "zh-TW": {
      "title": "繁體中文"
    }
  },
  "oauthUrl": "https://orcid.org/oauth/authorize?client_id=APP-J9YGHZ0YL4KAMGKV&redirect_uri=http%3A%2F%2Flocalhost%3A3000%2Fcallback%2Forcid%2Fauth&response_type=code&scope=%2Fauthenticate"
}

GET /system-notifications

取得系統公告。

GET /me

Get my profile.

auth

The user's permission should be 'administrator' or 'general-account'.

response

Field Type Note
id string
name string
email string
permission string enum: administrator, general-account

example

{
  "id": "5c949bbbe5d5377f98c81ab0",
  "name": "Your Name",
  "email": "email@example.com",
  "permission": "general-account"
}

PUT /me

Update my profile.

auth

The user's permission should be 'administrator' or 'general-account'.

payload

Field Type Required Note
name string required
email string

example

{
  "name": "Your Name",
  "email": "email@example.com"
}

response

Field Type Note
id string
name string
email string
permission string enum: administrator, general-account

example

{
  "id": "5c949bbbe5d5377f98c81ab0",
  "name": "Your Name",
  "email": "email@example.com",
  "permission": "general-account"
}

GET /me/notifications

取得該帳號收到的通知。

GET /me/upload-sessions

取得上傳紀錄。

auth

The user's permission should be 'administrator' or 'general-account'.

query

Field Type Required Default Note
index Number 0
size Number 100
sort string -createTime enum: createTime

response

Field Type Note
index Number The page index.
size Number The page size.
total Number Total of all documents.
items Array Documents.
Field Type Note
id string
state string enum: processing, wait-for-review, success, failure
project Object ProjectModel
cameraLocation Object CameraLocationModel
studyArea 如果是子樣區的話會包含
file Object FileModel
createTime Date

example

{
  "index": 0,
  "size": 100,
  "total": 1,
  "items": [
    {
      "id": "5ca996477242134e2593331d",
      "state": "success",
      "project": {
        "id": "5c9af1d2403d37067adadbc5",
        "title": "計畫名稱",
        "shortTitle": "計畫簡稱",
        "funder": "委辦單位",
        "code": "計畫編號",
        "principalInvestigator": "計畫主持人",
        "startTime": "2019-01-01T00:00:00.000Z",
        "endTime": "2029-01-01T00:00:00.000Z",
        "areas": [
          "5c9af16a4ee1b606477f9236"
        ],
        "coverImageFile": "5c9b1dfafc43be12b823b7b2",
        "members": [
          {
            "user": "5c949bbbe5d5377f98c81ab0",
            "role": "manager"
          },
          {
            "user": "5ca570886ee6391d81fd773e",
            "role": "researcher"
          }
        ],
        "dataFields": [
          "5c9af16a4ee1b606477f9229",
          "5c9af16a4ee1b606477f922a",
          "5c9af16a4ee1b606477f922b",
          "5c9af16a4ee1b606477f922c",
          "5c9af16a4ee1b606477f922d",
          "5c9af16a4ee1b606477f9231"
        ],
        "dailyTestTime": "13:00:00"
      },
      "cameraLocation": {
        "id": "5c9f28070d9cee99f8a11a12",
        "studyArea": {
          "id": "5c9d95acea5c9b4036d97c88",
          "title": {
            "zh-TW": "titleX"
          },
          "parent": {
            "id": "5c9d9428e7462d3d989cb69b",
            "title": {
              "zh-TW": "title"
            }
          }
        },
        "name": "PT02A",
        "settingTime": "2019-01-01T00:00:00.000Z",
        "latitude": 58.28,
        "longitude": 121.462417,
        "altitude": 100,
        "vegetation": "植被",
        "landCover": "土地覆蓋類型"
      },
      "file": {
        "id": "5ca996477242134e2593331c",
        "type": "annotation-image",
        "originalFilename": "IMG_1073.JPG",
        "filename": "5ca996477242134e2593331c.jpg",
        "url": "https://s3-ap-northeast-1.amazonaws.com/camera-trap-api-dev/annotation-images/5ca996477242134e2593331c.jpg",
        "size": 1609437
      },
      "createTime": "2019-04-07T06:18:47.234Z"
    }
  ]
}

POST /logout

Logout.

auth

The user's permission should be 'administrator' or 'general-account'.

response

Status Code: 204

GET /project-areas

取得計畫地區列表。

auth

The user's permission should be 'administrator' or 'general-account'.

query

Field Type Required Default Note
index Number 0
size Number 100
sort string title.zh-TW enum: title.zh-TW, title.en-US

response

Field Type Note
index Number The page index.
size Number The page size.
total Number Total of all documents.
items Array Documents.
Field Type Note
id string
title Object 行政區域名稱

example

{
  "index": 0,
  "size": 100,
  "total": 22,
  "items": [
    {
      "id": "5c9af16a4ee1b606477f9242",
      "title": {
        "zh-TW": "南投縣",
        "en-US": "Nantou County"
      }
    },
    {
      "id": "5c9af16a4ee1b606477f9239",
      "title": {
        "zh-TW": "台中市",
        "en-US": "Taichung City"
      }
    },
    {
      "id": "5c9af16a4ee1b606477f9236",
      "title": {
        "zh-TW": "台北市",
        "en-US": "Taipei City"
      }
    }
  ]
}

GET /projects

取得計畫列表。

auth

The user's permission should be 'administrator' or 'general-account'.
The administrator gets all projects.
The general-account gets the project who joined.

query

Field Type Required Default Note
index Number 0
size Number 24
sort string oldestAnnotationTime enum: oldestAnnotationTime, latestAnnotationTime, funder, title

response

Field Type Note
index Number The page index.
size Number The page size.
total Number Total of all documents.
items Array Documents.
Field Type Note
id string
title string 計畫名稱
shortTitle string 計畫簡稱
funder string 委辦單位
code string 計畫編號
principalInvestigator string 計畫主持人
startTime Date 計畫時間(開始)
endTime Date 計畫時間(結束)
areas Array<string> 計畫地區
ProjectAreaModel
description string 計畫摘要
note string 備註
coverImageFile Object 計畫封面圖片檔案
FileModel
publishTime Date 公開日期
interpretiveDataLicense string 詮釋資料 創用CC授權許可
enum: cc0 (無著作權 (CC0)), by (姓名標示), by-nc (姓名標示-非商業性)
identificationInformationLicense string 鑑定資訊 創用CC授權許可
enum: by (姓名標示)
videoMaterialLicense string 影像資料 創用CC授權許可
enum: cc0 (無著作權 (CC0)), by (姓名標示), by-nc (姓名標示-非商業性)
members Array<{user: {string}, role: {string}}> 計畫成員
role: manager (計畫管理員), researcher (計畫研究員), executor (計畫執行者)
dataFields Array<string> 資料欄位
dailyTestTime string 每日測試照片拍攝時間。
null 或空字串代表關閉此功能。
此欄位僅儲存字串,測試時尋找 csv 中時間欄位為此字串結尾且物種為測試。
latestAnnotationTime Date 資料最後更新時間
oldestAnnotationTime Date 資料起始年份

example

{
  "index": 0,
  "size": 24,
  "total": 1,
  "items": [
    {
      "id": "5c99e565fa899867c32377cf",
      "title": "計畫名稱",
      "shortTitle": "計畫簡稱",
      "funder": "委辦單位",
      "code": "計畫編號",
      "principalInvestigator": "計畫主持人",
      "startTime": "2019-01-01T00:00:00.000Z",
      "endTime": "2029-01-01T00:00:00.000Z",
      "areas": [
        "5c9af16a4ee1b606477f9236"
      ],
      "description": "計畫摘要",
      "note": "備註",
      "coverImageFile": {
        "id": "5c9b1dfafc43be12b823b7b2",
        "type": "project-cover-image",
        "originalFilename": "432x324c.jpg",
        "filename": "5c9b1dfafc43be12b823b7b2.jpg",
        "url": "https://s3-ap-northeast-1.amazonaws.com/camera-trap-api-dev/project-covers/5c9b1dfafc43be12b823b7b2.jpg",
        "size": 26172
      },
      "publishTime": "2029-01-01T00:00:00.000Z",
      "interpretiveDataLicense": "cc0",
      "identificationInformationLicense": "by",
      "videoMaterialLicense": "by",
      "members": [
        {
          "user": "5c949bbbe5d5377f98c81ab0",
          "role": "manager"
        }
      ],
      "dataFields": ["5c99bece337ea758248ffd5b"],
      "dailyTestTime": "13:00:00",
      "latestAnnotationTime": "2019-01-01T00:00:00.000Z",
      "oldestAnnotationTime": "2019-01-01T00:00:00.000Z"
    }
  ]
}

POST /projects

新增計畫。

auth

The user's permission should be 'administrator' or 'general-account'.

payload

Field Type Required Note
title string required 計畫名稱
shortTitle string required 計畫簡稱
funder string required 委辦單位
code string required 計畫編號
principalInvestigator string required 計畫主持人
startTime Date required 計畫時間(開始)
endTime Date required 計畫時間(結束)
areas Array<string> 計畫地區
內容為 ProjectAreaModel 的 id
description string 計畫摘要
note string 備註
coverImageFile string 計畫封面圖片檔案 id
內容為 FileModel 的 id
publishTime Date 公開日期
interpretiveDataLicense string 詮釋資料 創用CC授權許可
enum: cc0 (無著作權 (CC0)), by (姓名標示), by-nc (姓名標示-非商業性)
identificationInformationLicense string 鑑定資訊 創用CC授權許可
enum: by (姓名標示)
videoMaterialLicense string 影像資料 創用CC授權許可
enum: cc0 (無著作權 (CC0)), by (姓名標示), by-nc (姓名標示-非商業性)

example

{
  "title": "計畫名稱",
  "shortTitle": "計畫簡稱",
  "funder": "委辦單位",
  "code": "計畫編號",
  "principalInvestigator": "計畫主持人",
  "startTime": "2019-01-01T00:00:00.000Z",
  "endTime": "2029-01-01T00:00:00.000Z",
  "areas": [
    "5c9af16a4ee1b606477f9236"
  ],
  "description": "計畫摘要",
  "note": "備註",
  "coverImageFile": "5c9b1dfafc43be12b823b7b2",
  "publishTime": "2029-01-01T00:00:00.000Z",
  "interpretiveDataLicense": "cc0",
  "identificationInformationLicense": "by",
  "videoMaterialLicense": "by"
}

response

Field Type Note
id string
title string 計畫名稱
shortTitle string 計畫簡稱
funder string 委辦單位
code string 計畫編號
principalInvestigator string 計畫主持人
startTime Date 計畫時間(開始)
endTime Date 計畫時間(結束)
areas Array<ProjectAreaModel> 計畫地區
description string 計畫摘要
note string 備註
coverImageFile Object 計畫封面圖片檔案
FileModel
publishTime Date 公開日期
interpretiveDataLicense string 詮釋資料 創用CC授權許可
enum: cc0 (無著作權 (CC0)), by (姓名標示), by-nc (姓名標示-非商業性)
identificationInformationLicense string 鑑定資訊 創用CC授權許可
enum: by (姓名標示)
videoMaterialLicense string 影像資料 創用CC授權許可
enum: cc0 (無著作權 (CC0)), by (姓名標示), by-nc (姓名標示-非商業性)
members Array<{user: {UserModel}, role: {string}}> 計畫成員
role: manager (計畫管理員), researcher (計畫研究員), executor (計畫執行者)
dataFields Array<DataFieldModel> 資料欄位
dailyTestTime string 每日測試照片拍攝時間。
null 或空字串代表關閉此功能。
此欄位僅儲存字串,測試時尋找 csv 中時間欄位為此字串結尾且物種為測試。
latestAnnotationTime Date 資料最後更新時間
oldestAnnotationTime Date 資料起始年份

example

{
  "id": "5c99e565fa899867c32377cf",
  "title": "計畫名稱",
  "shortTitle": "計畫簡稱",
  "funder": "委辦單位",
  "code": "計畫編號",
  "principalInvestigator": "計畫主持人",
  "startTime": "2019-01-01T00:00:00.000Z",
  "endTime": "2029-01-01T00:00:00.000Z",
  "areas": [
    {
      "id": "5c9af16a4ee1b606477f9236",
      "title": {
        "zh-TW": "台北市",
        "en-US": "Taipei City"
      }
    }
  ],
  "description": "計畫摘要",
  "note": "備註",
  "coverImageFile": {
    "id": "5c9b1dfafc43be12b823b7b2",
    "type": "project-cover-image",
    "originalFilename": "432x324c.jpg",
    "filename": "5c9b1dfafc43be12b823b7b2.jpg",
    "url": "https://s3-ap-northeast-1.amazonaws.com/camera-trap-api-dev/project-covers/5c9b1dfafc43be12b823b7b2.jpg",
    "size": 26172
  },
  "publishTime": "2029-01-01T00:00:00.000Z",
  "interpretiveDataLicense": "cc0",
  "identificationInformationLicense": "by",
  "videoMaterialLicense": "by",
  "members": [
    {
      "user": {
        "id": "5c949bbbe5d5377f98c81ab0",
        "name": "測試",
        "email": "email@example.com",
        "permission": "general-account"
      },
      "role": "manager"
    }
  ],
  "dataFields": [
    {
      "id": "5c99bece337ea758248ffd5b",
      "systemCode": "study-area",
      "title": {
        "zh-TW": "樣區"
      },
      "widgetType": "select",
      "description": {
        "zh-TW": "樣區-子樣區"
      },
      "options": [
      ]
    }
  ],
  "dailyTestTime": "13:00:00",
  "latestAnnotationTime": "2019-01-01T00:00:00.000Z",
  "oldestAnnotationTime": "2019-01-01T00:00:00.000Z"
}

GET /projects/:projectId

取得計畫詳細資訊。

auth

The user's permission should be 'administrator' or 'general-account'.

response

Field Type Note
id string
title string 計畫名稱
shortTitle string 計畫簡稱
funder string 委辦單位
code string 計畫編號
principalInvestigator string 計畫主持人
startTime Date 計畫時間(開始)
endTime Date 計畫時間(結束)
areas Array<ProjectAreaModel> 計畫地區
description string 計畫摘要
note string 備註
coverImageFile Object 計畫封面圖片檔案
FileModel
publishTime Date 公開日期
interpretiveDataLicense string 詮釋資料 創用CC授權許可
enum: cc0 (無著作權 (CC0)), by (姓名標示), by-nc (姓名標示-非商業性)
identificationInformationLicense string 鑑定資訊 創用CC授權許可
enum: by (姓名標示)
videoMaterialLicense string 影像資料 創用CC授權許可
enum: cc0 (無著作權 (CC0)), by (姓名標示), by-nc (姓名標示-非商業性)
members Array<{user: {UserModel}, role: {string}}> 計畫成員
role: manager (計畫管理員), researcher (計畫研究員), executor (計畫執行者)
dataFields Array<DataFieldModel> 資料欄位
dailyTestTime string 每日測試照片拍攝時間。
null 或空字串代表關閉此功能。
此欄位僅儲存字串,測試時尋找 csv 中時間欄位為此字串結尾且物種為測試。
latestAnnotationTime Date 資料最後更新時間
oldestAnnotationTime Date 資料起始年份

example

{
  "id": "5c99e565fa899867c32377cf",
  "title": "計畫名稱",
  "shortTitle": "計畫簡稱",
  "funder": "委辦單位",
  "code": "計畫編號",
  "principalInvestigator": "計畫主持人",
  "startTime": "2019-01-01T00:00:00.000Z",
  "endTime": "2029-01-01T00:00:00.000Z",
  "areas": [
    {
      "id": "5c9af16a4ee1b606477f9236",
      "title": {
        "zh-TW": "台北市",
        "en-US": "Taipei City"
      }
    }
  ],
  "description": "計畫摘要",
  "note": "備註",
  "coverImageFile": {
    "id": "5c9b1dfafc43be12b823b7b2",
    "type": "project-cover-image",
    "originalFilename": "432x324c.jpg",
    "filename": "5c9b1dfafc43be12b823b7b2.jpg",
    "url": "https://s3-ap-northeast-1.amazonaws.com/camera-trap-api-dev/project-covers/5c9b1dfafc43be12b823b7b2.jpg",
    "size": 26172
  },
  "publishTime": "2029-01-01T00:00:00.000Z",
  "interpretiveDataLicense": "cc0",
  "identificationInformationLicense": "by",
  "videoMaterialLicense": "by",
  "members": [
    {
      "user": {
        "id": "5c949bbbe5d5377f98c81ab0",
        "name": "測試",
        "email": "email@example.com",
        "permission": "general-account"
      },
      "role": "manager"
    }
  ],
  "dataFields": [
    {
      "id": "5c99bece337ea758248ffd5b",
      "systemCode": "study-area",
      "title": {
        "zh-TW": "樣區"
      },
      "widgetType": "select",
      "description": {
        "zh-TW": "樣區-子樣區"
      },
      "options": [
      ]
    }
  ],
  "dailyTestTime": "13:00:00",
  "latestAnnotationTime": "2019-01-01T00:00:00.000Z",
  "oldestAnnotationTime": "2019-01-01T00:00:00.000Z"
}

PUT /projects/:projectId

更新計畫。

auth

The user's permission should be 'administrator' or 'general-account'.
The administrator gets all projects.
The general-account gets the project who joined and who is a project manager.

payload

Field Type Required Note
title string required 計畫名稱
shortTitle string required 計畫簡稱
funder string required 委辦單位
code string required 計畫編號
principalInvestigator string required 計畫主持人
startTime Date required 計畫時間(開始)
endTime Date required 計畫時間(結束)
areas Array<string> 計畫地區
內容為 ProjectAreaModel 的 id
description string 計畫摘要
note string 備註
coverImageFile string 計畫封面圖片檔案 id
內容為 FileModel 的 id
publishTime Date 公開日期
interpretiveDataLicense string 詮釋資料 創用CC授權許可
enum: cc0 (無著作權 (CC0)), by (姓名標示), by-nc (姓名標示-非商業性)
identificationInformationLicense string 鑑定資訊 創用CC授權許可
enum: by (姓名標示)
videoMaterialLicense string 影像資料 創用CC授權許可
enum: cc0 (無著作權 (CC0)), by (姓名標示), by-nc (姓名標示-非商業性)
dataFields Array<string> 資料欄位 id
dailyTestTime string 每日測試照片拍攝時間。
null 或空字串代表關閉此功能。
此欄位僅儲存字串,測試時尋找 csv 中時間欄位為此字串結尾且物種為測試。

example

{
  "title": "計畫名稱",
  "shortTitle": "計畫簡稱",
  "funder": "委辦單位",
  "code": "計畫編號",
  "principalInvestigator": "計畫主持人",
  "startTime": "2019-01-01T00:00:00.000Z",
  "endTime": "2029-01-01T00:00:00.000Z",
  "areas": [
    "5c9af16a4ee1b606477f9236"
  ],
  "description": "計畫摘要",
  "note": "備註",
  "coverImageFile": "5c9b1dfafc43be12b823b7b2",
  "publishTime": "2029-01-01T00:00:00.000Z",
  "interpretiveDataLicense": "cc0",
  "identificationInformationLicense": "by",
  "videoMaterialLicense": "by",
  "dataFields": [
    "5c9af16a4ee1b606477f9229",
    "5c9af16a4ee1b606477f922a",
    "5c9af16a4ee1b606477f922b",
    "5c9af16a4ee1b606477f922c",
    "5c9af16a4ee1b606477f922d"
  ],
  "dailyTestTime": "13:00:00"
}

response

Field Type Note
id string
title string 計畫名稱
shortTitle string 計畫簡稱
funder string 委辦單位
code string 計畫編號
principalInvestigator string 計畫主持人
startTime Date 計畫時間(開始)
endTime Date 計畫時間(結束)
areas Array<ProjectAreaModel> 計畫地區
description string 計畫摘要
note string 備註
coverImageFile Object 計畫封面圖片檔案
FileModel
publishTime Date 公開日期
interpretiveDataLicense string 詮釋資料 創用CC授權許可
enum: cc0 (無著作權 (CC0)), by (姓名標示), by-nc (姓名標示-非商業性)
identificationInformationLicense string 鑑定資訊 創用CC授權許可
enum: by (姓名標示)
videoMaterialLicense string 影像資料 創用CC授權許可
enum: cc0 (無著作權 (CC0)), by (姓名標示), by-nc (姓名標示-非商業性)
members Array<{user: {UserModel}, role: {string}}> 計畫成員
role: manager (計畫管理員), researcher (計畫研究員), executor (計畫執行者)
dataFields Array<DataFieldModel> 資料欄位
dailyTestTime string 每日測試照片拍攝時間。
null 或空字串代表關閉此功能。
此欄位僅儲存字串,測試時尋找 csv 中時間欄位為此字串結尾且物種為測試。
latestAnnotationTime Date 資料最後更新時間
oldestAnnotationTime Date 資料起始年份

example

{
  "id": "5c99e565fa899867c32377cf",
  "title": "計畫名稱",
  "shortTitle": "計畫簡稱",
  "funder": "委辦單位",
  "code": "計畫編號",
  "principalInvestigator": "計畫主持人",
  "startTime": "2019-01-01T00:00:00.000Z",
  "endTime": "2029-01-01T00:00:00.000Z",
  "areas": [
    {
      "id": "5c9af16a4ee1b606477f9236",
      "title": {
        "zh-TW": "台北市",
        "en-US": "Taipei City"
      }
    }
  ],
  "description": "計畫摘要",
  "note": "備註",
  "coverImageFile": {
    "id": "5c9b1dfafc43be12b823b7b2",
    "type": "project-cover-image",
    "originalFilename": "432x324c.jpg",
    "filename": "5c9b1dfafc43be12b823b7b2.jpg",
    "url": "https://s3-ap-northeast-1.amazonaws.com/camera-trap-api-dev/project-covers/5c9b1dfafc43be12b823b7b2.jpg",
    "size": 26172
  },
  "publishTime": "2029-01-01T00:00:00.000Z",
  "interpretiveDataLicense": "cc0",
  "identificationInformationLicense": "by",
  "videoMaterialLicense": "by",
  "members": [
    {
      "user": {
        "id": "5c949bbbe5d5377f98c81ab0",
        "name": "測試",
        "email": "email@example.com",
        "permission": "general-account"
      },
      "role": "manager"
    }
  ],
  "dataFields": [
    {
      "id": "5c99bece337ea758248ffd5b",
      "systemCode": "study-area",
      "title": {
        "zh-TW": "樣區"
      },
      "widgetType": "select",
      "description": {
        "zh-TW": "樣區-子樣區"
      },
      "options": [
      ]
    }
  ],
  "dailyTestTime": "13:00:00",
  "latestAnnotationTime": "2019-01-01T00:00:00.000Z",
  "oldestAnnotationTime": "2019-01-01T00:00:00.000Z"
}

GET /projects/:projectId/species

取得計畫的物種列表。

auth

The user's permission should be 'administrator' or 'general-account'.
The administrator gets all projects.
The general-account gets the project who joined.

query

Field Type Required Default Note
index Number 0
size Number 9007199254740991
sort string index enum: index

response

Field Type Note
index Number The page index.
size Number The page size.
total Number Total of all documents.
items Array Documents.
Field Type Note
id string
title Object 物種名稱
index Number 排序 (由小到大)
code string 提示定義
enum: empty-shot (空拍), test (測試), people (人)

example

{
  "index": 0,
  "size": 100,
  "total": 4,
  "items": [
    {
      "id": "5c99e565fa899867c32377d0",
      "title": {
        "zh-TW": "空拍"
      },
      "index": 0,
      "code": "empty-shot"
    },
    {
      "id": "5c99e565fa899867c32377d1",
      "title": {
        "zh-TW": "測試"
      },
      "index": 1,
      "code": "test"
    },
    {
      "id": "5c99e565fa899867c32377d2",
      "title": {
        "zh-TW": ""
      },
      "index": 2,
      "code": "people"
    },
    {
      "id": "5c99e9f772033c68e65592fb",
      "title": {
        "zh-TW": "test"
      },
      "index": 3
    }
  ]
}

PUT /projects/:projectId/species

批次新增、更新物種。

auth

The user's permission should be 'administrator' or 'general-account'.
The administrator gets all projects.
The general-account gets the project who joined and who is a project manager.

payload

Field Type Required Note
id string 物種 id
title Object required 物種名稱

example

[
  {
    "id": "5c9af1d2403d37067adadbc6"
  },
  {
    "id": "5c9af1d2403d37067adadbc7"
  },
  {
    "id": "5c9af1d2403d37067adadbc8"
  },
  {
    "title": {
      "zh-TW": "Create this one."
    }
  }
]

response

Field Type Note
id string
title Object 物種名稱
index Number 排序 (由小到大)

example

{
  "index": 0,
  "size": 9007199254740991,
  "total": 4,
  "items": [
    {
      "id": "5c9af1d2403d37067adadbc6",
      "title": {
        "zh-TW": "空拍"
      },
      "index": 0,
      "code": "empty-shot"
    },
    {
      "id": "5c9af1d2403d37067adadbc7",
      "title": {
        "zh-TW": "測試"
      },
      "index": 1,
      "code": "test"
    },
    {
      "id": "5c9af1d2403d37067adadbc8",
      "title": {
        "zh-TW": ""
      },
      "index": 2,
      "code": "people"
    },
    {
      "id": "5ca74924b92468b3ef96fcfd",
      "title": {
        "zh-TW": "Create this one."
      },
      "index": 3
    }
  ]
}

POST /projects/:projectId/species

新增計畫的物種。

auth

The user's permission should be 'administrator' or 'general-account'.
The administrator gets all projects.
The general-account gets the project who joined and who is a project manager.

payload

Field Type Required Note
title Object required 物種名稱
index Number 排序 (由小到大)

example

{
  "title": {
    "zh-TW": "山羌"
  },
  "index": 2
}

response

Field Type Note
id string
title Object 物種名稱
index Number 排序 (由小到大)

example

{
  "id": "5c949bbbe5d5377f98c81ab0",
  "title": {
    "zh-TW": "山羌"
  },
  "index": 2
}

PUT /projects/:projectId/species/:speciesId

修改計畫的物種。

auth

The user's permission should be 'administrator' or 'general-account'.
The administrator gets all projects.
The general-account gets the project who joined and who is a project manager.

payload

Field Type Required Note
title Object required 物種名稱
index Number 排序 (由小到大)

example

{
  "index": 2
}

response

Field Type Note
id string
title Object 物種名稱
index Number 排序 (由小到大)

example

{
  "id": "5c949bbbe5d5377f98c81ab0",
  "title": {
    "zh-TW": "山羌"
  },
  "index": 2
}

POST /projects/:projectId/members

新增計畫成員。

auth

The user's permission should be 'administrator' or 'general-account'.
The administrator gets all projects.
The general-account gets the project who joined and who is a project manager.

payload

Field Type Required Note
user string required 使用者的 orcId 或 email
role string required 成員權限
enum: manager (計畫管理員), researcher (計畫研究員), executor (計畫執行者)

example

{
  "user": "name@example.com",
  "role": "manager"
}

response

Field Type Note
user Object UserModel
role string 成員權限
enum: manager (計畫管理員), researcher (計畫研究員), executor (計畫執行者)

example

[
  {
    "user": {
      "id": "5c949bbbe5d5377f98c81ab0",
      "name": "測試",
      "email": "name@example.com",
      "permission": "general-account"
    },
    "role": "manager"
  }
]

PUT /projects/:projectId/members/:userId

新增計畫成員。

auth

The user's permission should be 'administrator' or 'general-account'.
The administrator gets all projects.
The general-account gets the project who joined and who is a project manager.

payload

Field Type Required Note
role string required 成員權限
enum: manager (計畫管理員), researcher (計畫研究員), executor (計畫執行者)

example

{
  "role": "researcher"
}

response

Field Type Note
user Object UserModel
role string 成員權限
enum: manager (計畫管理員), researcher (計畫研究員), executor (計畫執行者)

example

[
  {
    "user": {
      "id": "5c949bbbe5d5377f98c81ab0",
      "name": "測試",
      "email": "name@example.com",
      "permission": "general-account"
    },
    "role": "manager"
  },
  {
    "user": {
      "id": "5c949bbbe5d5377f98c81ab1",
      "name": "測試2",
      "email": "name2@example.com",
      "permission": "general-account"
    },
    "role": "researcher"
  }
]

DELETE /projects/:projectId/members/:userId

刪除計畫成員。

auth

The user's permission should be 'administrator' or 'general-account'.
The administrator gets all projects.
The general-account gets the project who joined and who is a project manager.

response

Status Code: 204

GET /projects/:projectId/study-areas

取得專案啟用的所有樣區。

auth

The user's permission should be 'administrator' or 'general-account'.

response

Field Type Note
id string
title Object 樣區名稱
children Array<StudyAreaModel> 子樣區

example

[
  {
    "id": "5c9d9428e7462d3d989cb69b",
    "title": {
      "zh-TW": "台北"
    },
    "children": [
      {
        "id": "5c9d9456e7462d3d989cb69c",
        "title": {
          "zh-TW": "內湖站"
        }
      },
      {
        "id": "5c9d95acea5c9b4036d97c88",
        "title": {
          "zh-TW": "大安站"
        }
      }
    ]
  }
]

POST /projects/:projectId/study-areas

新增樣區。

auth

The user's permission should be 'administrator' or 'general-account'.
The administrator gets all projects.
The general-account gets the project who joined and who is a project manager.

payload

Field Type Required Note
title Object required 樣區名稱
parent string 母樣區 id,新增子樣區時使用

example

{
  "title": {
    "zh-TW": "台北"
  },
  "parent": "5c9d9428e7462d3d989cb69b"
}

response

Field Type Note
id string
title Object 樣區名稱

example

{
  "id": "5c949bbbe5d5377f98c81ab0",
  "title": {
    "zh-TW": "台北"
  }
}

GET /projects/:projectId/camera-locations

檢查相機位置名稱是否已被使用。
同一計畫底下相機位置名稱不可重複,新增或修改相機位置前請先檢查是否有重複。

auth

The user's permission should be 'administrator' or 'general-account'.
The administrator gets all projects.
The general-account gets the project who joined.

query

Field Type Required Default Note
index Number 0
size Number 100
sort string name enum: name
name string 使用相機位置名稱搜尋

response

Field Type Note
index Number The page index.
size Number The page size.
total Number Total of all documents.
items Array Documents.
Field Type Note
id string
name string 相機位置名稱
studyArea string 樣區 id
settingTime Date 架設日期
latitude Number 緯度 (WGS84)
longitude Number 經度 (WGS84)
altitude Number 海拔(公尺)
vegetation string 植被
landCover string 土地覆蓋類型

example

{
  "index": 0,
  "size": 100,
  "total": 1,
  "items": [
    {
      "id": "5c9f28070d9cee99f8a11a12",
      "name": "PT02A",
      "studyArea": "5c9d95acea5c9b4036d97c88",
      "settingTime": "2019-01-01T00:00:00.000Z",
      "latitude": 58.28,
      "longitude": 121.462417,
      "altitude": 100,
      "vegetation": "植被",
      "landCover": "土地覆蓋類型"
    }
  ]
}

GET /projects/:projectId/study-areas/:studyAreaId/camera-locations

取得樣區底下啟用的相機位置。
如果指定的樣區是母樣區時會連子樣區的相機位置一起取得。

auth

The user's permission should be 'administrator' or 'general-account'.
The administrator gets all projects.
The general-account gets the project who joined.

query

Field Type Required Default Note
index Number 0
size Number 100
sort string name enum: name

response

Field Type Note
index Number The page index.
size Number The page size.
total Number Total of all documents.
items Array Documents.
Field Type Note
id string
name string 相機位置名稱
studyArea string 樣區 id
settingTime Date 架設日期
latitude Number 緯度 (WGS84)
longitude Number 經度 (WGS84)
altitude Number 海拔(公尺)
vegetation string 植被
landCover string 土地覆蓋類型

example

{
  "index": 0,
  "size": 100,
  "total": 2,
  "items": [
    {
      "id": "5c9f268cd8605e99862339ff",
      "name": "pT03B",
      "studyArea": "5c9d95acea5c9b4036d97c88",
      "latitude": 25.014051,
      "longitude": 121.462417
    },
    {
      "id": "5c9f28070d9cee99f8a11a12",
      "name": "PT02A",
      "studyArea": "5c9d95acea5c9b4036d97c88",
      "settingTime": "2019-01-01T00:00:00.000Z",
      "latitude": 58.28,
      "longitude": 121.462417,
      "altitude": 100,
      "vegetation": "植被",
      "landCover": "土地覆蓋類型"
    }
  ]
}

POST /projects/:projectId/study-areas/:studyAreaId/camera-locations

在指定的樣區新增相機位置。

auth

The user's permission should be 'administrator' or 'general-account'.
The administrator gets all projects.
The general-account gets the project who joined and who is a project manager.

payload

Field Type Required Note
name string required 相機位置名稱
settingTime Date 架設日期
latitude Number required 緯度 (WGS84)
longitude Number required 經度 (WGS84)
altitude Number 海拔(公尺)
vegetation string 植被
landCover string 土地覆蓋類型

example

{
  "name": "PT02A",
  "settingTime": "2019-01-01T00:00:00.000Z",
  "latitude": 58.28,
  "longitude": 121.462417,
  "altitude": 100,
  "vegetation": "植被",
  "landCover": "土地覆蓋類型"
}

response

Field Type Note
id string
name string 相機位置名稱
studyArea Object StudyAreaModel
settingTime Date 架設日期
latitude Number 緯度 (WGS84)
longitude Number 經度 (WGS84)
altitude Number 海拔(公尺)
vegetation string 植被
landCover string 土地覆蓋類型

example

{
  "id": "5c9f28070d9cee99f8a11a12",
  "name": "PT02A",
  "studyArea": {
    "id": "5c9d95acea5c9b4036d97c88",
    "title": {
      "zh-TW": "titleX"
    }
  },
  "settingTime": "2019-01-01T00:00:00.000Z",
  "latitude": 58.28,
  "longitude": 121.462417,
  "altitude": 100,
  "vegetation": "植被"
}

PUT /projects/:projectId/camera-locations/:cameraLocationId

更新相機位置。(因為操作相機位置時前端有可能不知道關聯的樣區所以省略指定樣區)

auth

The user's permission should be 'administrator' or 'general-account'.
The administrator gets all projects.
The general-account gets the project who joined and who is a project manager.

payload

Field Type Required Note
name string required 相機位置名稱
settingTime Date 架設日期
latitude Number required 緯度 (WGS84)
longitude Number required 經度 (WGS84)
altitude Number 海拔(公尺)
vegetation string 植被
landCover string 土地覆蓋類型

example

{
  "name": "PT02A",
  "settingTime": "2019-01-01T00:00:00.000Z",
  "latitude": 58.28,
  "longitude": 121.462417,
  "altitude": 100,
  "vegetation": "植被",
  "landCover": "土地覆蓋類型"
}

response

Field Type Note
id string
name string 相機位置名稱
studyArea Object StudyAreaModel
settingTime Date 架設日期
latitude Number 緯度 (WGS84)
longitude Number 經度 (WGS84)
altitude Number 海拔(公尺)
vegetation string 植被
landCover string 土地覆蓋類型

example

{
  "id": "5c9f28070d9cee99f8a11a12",
  "studyArea":{
    "id": "5c9d95acea5c9b4036d97c88",
    "title":{
      "zh-TW": "titleX"
    }
  },
  "name": "PT02A",
  "settingTime": "2019-01-01T00:00:00.000Z",
  "latitude": 58.28,
  "longitude": 121.462417,
  "altitude": 100,
  "vegetation": "植被"
}

DELETE /projects/:projectId/camera-locations/:cameraLocationId

刪除相機位置。(因為操作相機位置時前端有可能不知道關聯的樣區所以省略指定樣區)

auth

The user's permission should be 'administrator' or 'general-account'.
The administrator gets all projects.
The general-account gets the project who joined and who is a project manager.

response

Status Code: 204

GET /annotations

搜尋標註。

auth

The user's permission should be 'administrator' or 'general-account'.
The administrator gets all projects.
The general-account gets the project who joined.

query

Field Type Required Default Note
studyArea string 使用樣區 id 搜尋標註,回傳結果包含子樣區資料。
cameraLocations Array 使用相機位置 id 搜尋標註。
多個相機位置:?cameraLocations=5c9f28070d9cee99f8a11a12&cameraLocations=5c9f28070d9cee99f8a11a13
startTime Date 開始時間 ex: "2017-11-09T03:48:46.000Z"
endTime Date 結束時間 ex: "2017-11-09T03:48:46.000Z"
index Number 0
size Number 100
sort string name enum: name

response

Field Type Note
index Number The page index.
size Number The page size.
total Number Total of all documents.
items Array Documents.
Field Type Note
id string
studyArea string 樣區 id
cameraLocation string 相機位置 id
failures Array enum: new-species (物種不在預設中)
filename string 檔名
file Object FileModel
time Date 時間
species Object SpeciesModel
fields Array 因為一次最多取得 1,500 筆資料,為壓縮資料量請先取得計畫的 dataField 並自行比對。
{dataField: string, value: string}

example

{
  "index": 0,
  "size": 100,
  "total": 2,
  "items": [
    {
      "id": "5cbabb2c84bf6a8dc5ccf960",
      "studyArea": "5c9d95acea5c9b4036d97c88",
      "cameraLocation": "5c9f28070d9cee99f8a11a12",
      "failures": [
      ],
      "filename": "IMG_7191.JPG",
      "time": "2010-07-25T04:27:48.000Z",
      "species": {
        "id": "5c9af1d2403d37067adadbc7",
        "title": {
          "zh-TW": "測試"
        },
        "index": 1,
        "code": "test"
      },
      "fields": [
        {
          "dataField": "5c9af16a4ee1b606477f9231",
          "value": "5c9af16a4ee1b606477f9234"
        }
      ]
    },
    {
      "id": "5cbabad384bf6a8dc5ccf94b",
      "studyArea": "5c9d95acea5c9b4036d97c88",
      "cameraLocation": "5c9f28070d9cee99f8a11a12",
      "failures": [
      ],
      "filename": "IMG_7191.JPG",
      "file": {
        "id": "5cbabb0284bf6a8dc5ccf953",
        "type": "annotation-image",
        "originalFilename": "IMG_7191.JPG",
        "filename": "5cbabb0284bf6a8dc5ccf953.jpg",
        "url": "https://s3-ap-northeast-1.amazonaws.com/camera-trap-api-dev/annotation-images/5cbabb0284bf6a8dc5ccf953.jpg",
        "size": 3934239
      },
      "time": "2017-11-09T03:48:46.000Z",
      "fields": [
      ]
    }
  ]
}

PUT /annotations/:annotationId

更新標註。

auth

The user's permission should be 'administrator' or 'general-account'.
The administrator gets all projects.
The general-account gets the project who joined.

payload

Field Type Required Note
species string 物種 id
fields Array {dataField: string, value: string}

example

{
  "species": "5c9af1d2403d37067adadbc7",
  "fields": [
    {
      "dataField": "5c9af16a4ee1b606477f9231",
      "value": "5c9af16a4ee1b606477f9234"
    }
  ]
}

response

Field Type Note
id string
studyArea string 樣區 id
cameraLocation string 相機位置 id
failures Array enum: new-species (物種不在預設中)
filename string 檔名
file Object FileModel
time Date 時間
species Object SpeciesModel
fields Array {dataField: string, value: string}

example

{
  "id": "5cbabb2c84bf6a8dc5ccf960",
  "studyArea": "5c9d95acea5c9b4036d97c88",
  "cameraLocation": "5c9f28070d9cee99f8a11a12",
  "failures": [
  ],
  "filename": "IMG_7191.JPG",
  "file": {
    "id": "5cbabb0284bf6a8dc5ccf953",
    "type": "annotation-image",
    "originalFilename": "IMG_7191.JPG",
    "filename": "5cbabb0284bf6a8dc5ccf953.jpg",
    "url": "https://s3-ap-northeast-1.amazonaws.com/camera-trap-api-dev/annotation-images/5cbabb0284bf6a8dc5ccf953.jpg",
    "size": 3934239
  },
  "time": "2010-07-25T04:27:48.000Z",
  "species": {
    "id": "5c9af1d2403d37067adadbc7",
    "title": {
      "zh-TW": "測試"
    },
    "index": 1,
    "code": "test"
  },
  "fields": [
    {
      "dataField": {
        "id": "5c9af16a4ee1b606477f9231",
        "state": "approved",
        "title": {
          "zh-TW": "年齡"
        },
        "widgetType": "select",
        "description": {
          "zh-TW": "成體、亞成體、幼體"
        },
        "options": [
          {
            "id": "5c9af16a4ee1b606477f9234",
            "zh-TW": "成體"
          },
          {
            "id": "5c9af16a4ee1b606477f9233",
            "zh-TW": "亞成體"
          },
          {
            "id": "5c9af16a4ee1b606477f9232",
            "zh-TW": "幼體"
          }
        ]
      },
      "value": "5c9af16a4ee1b606477f9234"
    }
  ]
}

GET /data-fields

取得可用的欄位列表。

auth

The user's permission should be 'administrator' or 'general-account'.

query

Field Type Required Default Note
index Number 0
size Number 100
sort string name enum: name
filter string enum: system, custom

response

Field Type Note
index Number The page index.
size Number The page size.
total Number Total of all documents.
items Array Documents.
Field Type Note
id string
systemCode string 供判斷為何種系統預設欄位使用,空為客製化欄位。
enum: study-area (樣區), camera-location (相機位置), file-name (檔名), time (時間), species (物種)
title Object 欄位名稱
widgetType string 欄位形式
enum: text (輸入框), select (下拉選單), time (日期時間)
description Object 輸入格式內容
options Array<{id: {string}, zh-TW: {string}> 欄位形式為下拉選單時儲存輸入格式內容
note string 備註

example

{
  "index": 0,
  "size": 100,
  "total": 7,
  "items": [
    {
      "id": "5c9af16a4ee1b606477f9229",
      "systemCode": "study-area",
      "title": {
        "zh-TW": "樣區"
      },
      "widgetType": "select",
      "description": {
        "zh-TW": "樣區-子樣區"
      },
      "options": []
    },
    {
      "id": "5c9af16a4ee1b606477f922a",
      "systemCode": "camera-location",
      "title": {
        "zh-TW": "相機位置"
      },
      "widgetType": "select",
      "description": {
        "zh-TW": "相機位置名稱"
      },
      "options": []
    },
    {
      "id": "5c9af16a4ee1b606477f922b",
      "systemCode": "file-name",
      "title": {
        "zh-TW": "檔名"
      },
      "widgetType": "text",
      "description": {
        "zh-TW": "01234.jpg"
      },
      "options": []
    },
    {
      "id": "5c9af16a4ee1b606477f922c",
      "systemCode": "time",
      "title": {
        "zh-TW": "日期時間"
      },
      "widgetType": "time",
      "description": {
        "zh-TW": "YY/MM/DD hh:mm"
      },
      "options": []
    },
    {
      "id": "5c9af16a4ee1b606477f922d",
      "systemCode": "species",
      "title": {
        "zh-TW": "物種"
      },
      "widgetType": "select",
      "description": {
        "zh-TW": ""
      },
      "options": []
    },
    {
      "id": "5c9af16a4ee1b606477f922e",
      "title": {
        "zh-TW": "性別"
      },
      "widgetType": "select",
      "description": {
        "zh-TW": "公、母"
      },
      "options": [
        {
          "id": "5c9af16a4ee1b606477f9230",
          "zh-TW": ""
        },
        {
          "id": "5c9af16a4ee1b606477f922f",
          "zh-TW": ""
        }
      ]
    },
    {
      "id": "5c9af16a4ee1b606477f9235",
      "title": {
        "zh-TW": "備註"
      },
      "widgetType": "text",
      "description": {
        "zh-TW": ""
      },
      "options": []
    }
  ]
}

POST /data-fields

申請新欄位。

auth

The user's permission should be 'administrator' or 'general-account'.

payload

Field Type Required Note
title Object 欄位名稱
widgetType string 欄位形式
enum: text (輸入框), select (下拉選單), time (日期時間)
description Object 輸入格式內容
options Array<{id: {string}, zh-TW: {string}> 欄位形式為下拉選單時儲存輸入格式內容
note string 備註

example

{
  "title": {
    "zh-TW": "title"
  },
  "widgetType": "select",
  "description": {
    "zh-TW": "description"
  },
  "options": [
    {"zh-TW": "xx"}
  ]
}

response

Field Type Note
id string
title Object 欄位名稱
widgetType string 欄位形式
enum: text (輸入框), select (下拉選單), time (日期時間)
description Object 輸入格式內容
options Array<{id: {string}, zh-TW: {string}> 欄位形式為下拉選單時儲存輸入格式內容
note string 備註

example

{
  "id": "5c9f31037ef1509d50d2911f",
  "title": {
    "zh-TW": "title"
  },
  "widgetType": "select",
  "description": {
    "zh-TW": "description"
  },
  "options": [
    {
      "id": "5c9f31037ef1509d50d29120",
      "zh-TW": "xx"
    }
  ]
}

GET /data-fields/:dataFieldId

取得欄位詳細資料。

auth

The user's permission should be 'administrator' or 'general-account'.

response

Field Type Note
id string
systemCode string 供判斷為何種系統預設欄位使用,空為客製化欄位。
enum: study-area (樣區), camera-location (相機位置), file-name (檔名), time (時間), species (物種)
state string 狀態
enum: wait-for-review (等待審核), approved (審核通過並發布), rejected (審核未通過)
title Object 欄位名稱
widgetType string 欄位形式
enum: text (輸入框), select (下拉選單), time (日期時間)
description Object 輸入格式內容
options Array<{id: {string}, zh-TW: {string}> 欄位形式為下拉選單時儲存輸入格式內容
note string 備註

example

{
  "id": "5c9af16a4ee1b606477f922e",
  "state": "approved",
  "title": {
    "zh-TW": "性別"
  },
  "widgetType": "select",
  "description": {
    "zh-TW": "公、母"
  },
  "options": [
    {
      "id": "5c9af16a4ee1b606477f9230",
      "zh-TW": ""
    },
    {
      "id": "5c9af16a4ee1b606477f922f",
      "zh-TW": ""
    }
  ]
}

POST /files

上傳檔案。

auth

The user's permission should be 'administrator' or 'general-account'.

query

Field Type Required Default Note
type string required enum: project-cover-image, annotation-image (上傳單一圖片), annotation-csv (上傳單一csv), annotation-zip (上傳包含多張圖片及 csv 的壓縮檔)
目前 zip 檔不支援 csv。
cameraLocation string 上傳 annotation 相關檔案時必須包含相機位置。

payload

Content-Type: multipart/form-data
The input name is "file" of the form.

Field Type Required Note
file file required

response

Field Type Note
id string
type string 檔案類別
originalFilename string 原始檔名
filename string 儲存於 S3 使用的檔名
url string 資源網址
size Number 檔案大小

example

{
  "id": "5c9afa256c59080852644719",
  "type": "project-cover-image",
  "originalFilename": "432x324c.jpg",
  "filename": "5c9afa256c59080852644719.jpg",
  "url": "https://s3-ap-northeast-1.amazonaws.com/camera-trap-api-dev/project-covers/5c9afa256c59080852644719.jpg",
  "size": 26172
}

API documentation

V1

Legacy docs

Clone this wiki locally