fathomnet / worms-server

Fast WoRMS name server
http://fathomnet.org:8888/docs/
MIT License
9 stars 1 forks source link

Starts with including record #3

Closed ermbutler closed 1 year ago

ermbutler commented 1 year ago

It would be great for the starts with endpoint to have a param option to return the entire record.

In some cases the return string needs to then be matched to a rank which requires a 2nd call.

hohonuuli commented 1 year ago

@ermbutler Completed in https://github.com/fathomnet/worms-server/releases/tag/0.4.1, although slightly different than your request. I added a new endpoint /taxa/query/startswith/{prefix}. Let me know if this is what you needed.

Example request and response

http://fathomnet.org:8888/taxa/query/startswith/nanomia

[
  {
    "name": "Nanomia",
    "rank": "Genus",
    "aphiaId": 135392,
    "alternateNames": [
      "シダレザクラクラゲ属"
    ]
  },
  {
    "name": "Nanomia bijuga",
    "rank": "Species",
    "aphiaId": 135495,
    "alternateNames": [
      "シダレザクラクラゲ"
    ]
  },
  {
    "name": "Nanomia cara",
    "rank": "Species",
    "aphiaId": 135496,
    "alternateNames": [
      "ナガヨウラクラゲ"
    ]
  }
]
ermbutler commented 1 year ago

Amazing thanks @hohonuuli !