Skip to content

api_endpoints

API Endpoints for PlantDB client.Link

This module provides helper functions to construct URL paths for the PlantDB REST API. Each function returns the endpoint string with an optional prefix and performs basic sanitization of identifiers.

Key FeaturesLink

  • Sanitizes and validates scan, fileset, and file names.
  • Supports optional URL prefixes for API versioning.
  • Generates paths for authentication, health checks, scans, images, and archives.

Usage ExamplesLink

>>> from plantdb.commons import api_endpoints
>>> api_endpoints.login()
'/api/v1/auth/login'
>>> api_endpoints.scan('plant1')
'/api/v1/scans/plant1'

Resource mappingLink

Hereafter we detail the hierarchy of the resources defined in plantdb.server.api.* submodules and the Flask REST API in the plantdb.server.cli.fsdb_rest_api submodule.

/api/v1/
      ├─ health       (GET) → REST API status
      ├─ refresh/     (GET) → Reload the whole database
      │   └─ {scan_id}     (GET) → Reload the scan
      ├─ auth/
      │   ├─ login         (POST) → user login
      │   ├─ logout        (POST) → user logout
      │   ├─ register      (POST) → new user registration
      │   └─ tokens/
      │       ├─ refresh            (GET) → retrieve a specific scan
      │       ├─ validation         (GET) → retrieve a specific scan
      │       └─ create-api-token   (POST) → create-api-token
      ├─ scans/
      │   ├─ (GET)     → list scans
      │   ├─ info      (GET) → list scans
      │   └─ {scan_id}/
      │       ├─ (GET)    → retrieve a specific scan
      │       ├─ (POST)   → create a new scan
      │       ├─ metadata/
      │       │   ├─ (GET)   → get `scan_id` metadata
      │       │   └─ (POST)  → update `scan_id` metadata
      │       └─ filesets   (GET) → list filesets for scan
      ├─ filesets/
      │   └─ {scan_id}/
      │       └─ {fileset_id}/
      │           ├─ (POST)      → create new fileset
      │           ├─ metadata/
      │           │   ├─ (GET)   → get `scan_id/fileset_id` metadata
      │           │   └─ (POST)  → update `scan_id/fileset_id` metadata
      │           └─ files      (GET) → list files
      ├─ files/
      │   └─ {scan_id}/
      │       └─ {fileset_id}/
      │           └─ {file_id}/
      │               ├─ (GET)       → retrieve file
      │               ├─ (POST)      → create new file
      │               └─ metadata/   → (GET, POST)
      │                   ├─ (GET)   → get `scan_id/fileset_id/file_id` metadata
      │                   └─ (POST)  → update `scan_id/fileset_id/file_id` metadata
      └─ assets/
          ├─ files/{file_path}      (GET) → retrieve a specific scan
          ├─ archive/{scan_id}
          │   ├─ (GET)              → retrieve scan archive
          │   └─ (POST)             → create a new scan by uploading a scan archive
          ├─ image/{scan_id}/{fileset_id}/{file_id}
          │   ├─ (GET)              → get `scan_id/fileset_id/file_id` image
          │   └─ (POST)             → create a new `scan_id/fileset_id/file_id` image
          ├─ pointcloud/{scan_id}   (GET) → retrieve scan pointcloud
          ├─ mesh/{scan_id}         (GET) → retrieve scan triangular mesh
          ├─ sequence/{scan_id}     (GET) → retrieve scan sequence
          └─ skeleton/{scan_id}     (GET) → retrieve scan skeleton

api_prefix Link

api_prefix(endpoint_path)

Wrap an endpoint path generator with an optional URL prefix.

The prefix keyword argument, when given, represents a deployment prefix (e.g. /plantdb for a reverse-proxy at that path). It is composed in front of the API version prefix (API_PREFIX = "/api/v1").

Examples:

>>> from plantdb.commons import api_endpoints
>>> api_endpoints.login()
'/api/v1/auth/login'
>>> api_endpoints.login(prefix='/plantdb')
'/plantdb/api/v1/auth/login'
>>> api_endpoints.login(prefix=None)
'/api/v1/auth/login'
Source code in plantdb/commons/api_endpoints.py
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
def api_prefix(endpoint_path):
    """Wrap an endpoint path generator with an optional URL prefix.

    The ``prefix`` keyword argument, when given, represents a **deployment prefix**
    (_e.g._ ``/plantdb`` for a reverse-proxy at that path).  It is composed
    **in front of** the API version prefix (``API_PREFIX = "/api/v1"``).

    Examples
    --------
    >>> from plantdb.commons import api_endpoints
    >>> api_endpoints.login()
    '/api/v1/auth/login'
    >>> api_endpoints.login(prefix='/plantdb')
    '/plantdb/api/v1/auth/login'
    >>> api_endpoints.login(prefix=None)
    '/api/v1/auth/login'
    """

    def wrapper(*args, **kwargs):
        deploy_prefix = kwargs.pop("prefix", "") or ""
        deploy_prefix = deploy_prefix.strip("/")
        # Assemble parts, filtering out empty components
        parts = [p for p in [deploy_prefix, API_PREFIX.strip("/")] if p]
        composed_prefix = "/" + "/".join(parts) if parts else ""
        raw = endpoint_path(*args, **kwargs)  # e.g. "/auth/login" or "/"
        return composed_prefix + raw

    return wrapper

archive Link

archive(scan_id, **kwargs)

Return the URL path to the dataset archive endpoint.

Parameters:

Name Type Description Default

scan_id Link

str

The name of the scan dataset to archive.

required

Other Parameters:

Name Type Description
prefix str

An optional prefix to prepend to the URL path.

Returns:

Type Description
str

The URL path to the dataset archive endpoint.

Examples:

>>> from plantdb.commons import api_endpoints
>>> api_endpoints.archive('scan1')
'/api/v1/assets/archive/scan1'
Source code in plantdb/commons/api_endpoints.py
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
@api_prefix
def archive(scan_id: str, **kwargs) -> str:
    """Return the URL path to the dataset archive endpoint.

    Parameters
    ----------
    scan_id : str
        The name of the scan dataset to archive.

    Other Parameters
    ----------------
    prefix : str
        An optional prefix to prepend to the URL path.

    Returns
    -------
    str
        The URL path to the dataset archive endpoint.

    Examples
    --------
    >>> from plantdb.commons import api_endpoints
    >>> api_endpoints.archive('scan1')
    '/api/v1/assets/archive/scan1'
    """
    scan_id = sanitize_name(scan_id)
    return ARCHIVE.format(scan_id=scan_id)

create_api_token Link

create_api_token(**kwargs)

Return the URL path to the API token creation endpoint.

Other Parameters:

Name Type Description
prefix str

An optional prefix to prepend to the URL path.

Returns:

Type Description
str

The URL path to the API token creation endpoint.

Examples:

>>> from plantdb.commons import api_endpoints
>>> api_endpoints.create_api_token()
'/api/v1/auth/token/create-api-token'
Source code in plantdb/commons/api_endpoints.py
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
@api_prefix
def create_api_token(**kwargs):
    """Return the URL path to the API token creation endpoint.

    Other Parameters
    ----------------
    prefix : str
        An optional prefix to prepend to the URL path.

    Returns
    -------
    str
        The URL path to the API token creation endpoint.

    Examples
    --------
    >>> from plantdb.commons import api_endpoints
    >>> api_endpoints.create_api_token()
    '/api/v1/auth/token/create-api-token'
    """
    return CREATE_API_TOKEN

file Link

file(scan_id, fileset_id, file_id, **kwargs)

Return the URL path to the scan/fileset/file endpoint.

Parameters:

Name Type Description Default

scan_id Link

str

The name of the scan dataset containing the file.

required

fileset_id Link

str

The name of the fileset containing the file.

required

file_id Link

str

The name of the file.

required

Other Parameters:

Name Type Description
prefix str

An optional prefix to prepend to the URL path.

Returns:

Type Description
str

The URL path to the file endpoint.

Examples:

>>> from plantdb.commons import api_endpoints
>>> api_endpoints.file('real_plant', 'images', '00000_rgb')
'/api/v1/files/real_plant/images/00000_rgb'
Source code in plantdb/commons/api_endpoints.py
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
@api_prefix
def file(scan_id: str, fileset_id: str, file_id: str, **kwargs) -> str:
    """Return the URL path to the `scan/fileset/file` endpoint.

    Parameters
    ----------
    scan_id : str
        The name of the scan dataset containing the file.
    fileset_id : str
        The name of the fileset containing the file.
    file_id : str
        The name of the file.

    Other Parameters
    ----------------
    prefix : str
        An optional prefix to prepend to the URL path.

    Returns
    -------
    str
        The URL path to the file endpoint.

    Examples
    --------
    >>> from plantdb.commons import api_endpoints
    >>> api_endpoints.file('real_plant', 'images', '00000_rgb')
    '/api/v1/files/real_plant/images/00000_rgb'
    """
    scan_id = sanitize_name(scan_id)
    fileset_id = sanitize_name(fileset_id)
    file_id = sanitize_name(file_id)
    return FILE.format(scan_id=scan_id, fileset_id=fileset_id, file_id=file_id)

file_metadata Link

file_metadata(scan_id, fileset_id, file_id, key=None, **kwargs)

URL to access the file metadata associated with the given scan and fileset name.

Parameters:

Name Type Description Default

scan_id Link

str

The name of the scan to access.

required

fileset_id Link

str

The name of the fileset to access.

required

file_id Link

str

The name of the file to access.

required

key Link

str

A specific metadata key to fetch.

None

Other Parameters:

Name Type Description
prefix str

An optional prefix to prepend to the URL path.

Returns:

Type Description
str

The URL path to file metadata.

Examples:

>>> from plantdb.commons import api_endpoints
>>> api_endpoints.file_metadata('real_plant', 'images', '00000_rgb')
'/api/v1/files/real_plant/images/00000_rgb/metadata'
Source code in plantdb/commons/api_endpoints.py
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
@api_prefix
def file_metadata(scan_id: str, fileset_id: str, file_id: str, key: str | None = None, **kwargs) -> str:
    """URL to access the file metadata associated with the given scan and fileset name.

    Parameters
    ----------
    scan_id : str
        The name of the scan to access.
    fileset_id : str
        The name of the fileset to access.
    file_id : str
        The name of the file to access.
    key : str
        A specific metadata key to fetch.

    Other Parameters
    ----------------
    prefix : str
        An optional prefix to prepend to the URL path.

    Returns
    -------
    str
        The URL path to file metadata.

    Examples
    --------
    >>> from plantdb.commons import api_endpoints
    >>> api_endpoints.file_metadata('real_plant', 'images', '00000_rgb')
    '/api/v1/files/real_plant/images/00000_rgb/metadata'
    """
    scan_id = sanitize_name(scan_id)
    fileset_id = sanitize_name(fileset_id)
    file_id = sanitize_name(file_id)

    # Assemble optional query parameters
    query: dict[str, str] = {}
    if key is not None:
        query["key"] = str(key)

    query_str = f"?{parse.urlencode(query)}" if query else ""
    return (
            FILE_MD.format(scan_id=scan_id, fileset_id=fileset_id, file_id=file_id)
            + f"{query_str}"
    )

file_path Link

file_path(file_path, **kwargs)

Return the URL path to the scan/file_path endpoint.

Parameters:

Name Type Description Default

file_path Link

str

The path to the file in the database.

required

Other Parameters:

Name Type Description
prefix str

An optional prefix to prepend to the URL path.

Returns:

Type Description
str

The URL path to the file path endpoint.

Examples:

>>> from plantdb.commons import api_endpoints
>>> api_endpoints.file_path('real_plant/images/00000_rgb.jpg')
'/api/v1/assets/files/real_plant/images/00000_rgb.jpg'
Source code in plantdb/commons/api_endpoints.py
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
@api_prefix
def file_path(file_path: str, **kwargs) -> str:
    """Return the URL path to the `scan/file_path` endpoint.

    Parameters
    ----------
    file_path : str
        The path to the file in the database.

    Other Parameters
    ----------------
    prefix : str
        An optional prefix to prepend to the URL path.

    Returns
    -------
    str
        The URL path to the file path endpoint.

    Examples
    --------
    >>> from plantdb.commons import api_endpoints
    >>> api_endpoints.file_path('real_plant/images/00000_rgb.jpg')
    '/api/v1/assets/files/real_plant/images/00000_rgb.jpg'
    """
    return FILE_PATH.format(file_path=file_path.lstrip("/"))

fileset Link

fileset(scan_id, fileset_id, **kwargs)

URL path for a fileset belonging to a scan.

Parameters:

Name Type Description Default

scan_id Link

str

The name of the scan to access.

required

fileset_id Link

str

The name of the fileset to access.

required

Other Parameters:

Name Type Description
prefix str

An optional prefix to prepend to the URL path.

Returns:

Type Description
str

The URL path to file metadata.

Examples:

>>> from plantdb.commons import api_endpoints
>>> api_endpoints.fileset('real_plant', 'images')
'/api/v1/filesets/real_plant/images'
Source code in plantdb/commons/api_endpoints.py
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
@api_prefix
def fileset(scan_id:str, fileset_id:str, **kwargs) -> str:
    """URL path for a fileset belonging to a scan.

    Parameters
    ----------
    scan_id : str
        The name of the scan to access.
    fileset_id : str
        The name of the fileset to access.

    Other Parameters
    ----------------
    prefix : str
        An optional prefix to prepend to the URL path.

    Returns
    -------
    str
        The URL path to file metadata.

    Examples
    --------
    >>> from plantdb.commons import api_endpoints
    >>> api_endpoints.fileset('real_plant', 'images')
    '/api/v1/filesets/real_plant/images'
    """
    scan_id = sanitize_name(scan_id)
    fileset_id = sanitize_name(fileset_id)
    return FILESET.format(scan_id=scan_id, fileset_id=fileset_id)

fileset_files_list Link

fileset_files_list(scan_id, fileset_id, **kwargs)

URL to list the file associated with the given scan and filesets names.

Parameters:

Name Type Description Default

scan_id Link

str

The name of the scan to access.

required

fileset_id Link

str

The name of the fileset to access.

required

Other Parameters:

Name Type Description
prefix str

An optional prefix to prepend to the URL path.

Returns:

Type Description
str

The URL path to the filesets list of files.

Examples:

>>> from plantdb.commons import api_endpoints
>>> api_endpoints.fileset_files_list('real_plant', 'images')
'/api/v1/filesets/real_plant/images/files'
Source code in plantdb/commons/api_endpoints.py
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
@api_prefix
def fileset_files_list(scan_id: str, fileset_id: str, **kwargs) -> str:
    """URL to list the file associated with the given scan and filesets names.

    Parameters
    ----------
    scan_id : str
        The name of the scan to access.
    fileset_id : str
        The name of the fileset to access.

    Other Parameters
    ----------------
    prefix : str
        An optional prefix to prepend to the URL path.

    Returns
    -------
    str
        The URL path to the filesets list of files.

    Examples
    --------
    >>> from plantdb.commons import api_endpoints
    >>> api_endpoints.fileset_files_list('real_plant', 'images')
    '/api/v1/filesets/real_plant/images/files'
    """
    scan_id = sanitize_name(scan_id)
    fileset_id = sanitize_name(fileset_id)
    return FILESET_FILES.format(scan_id=scan_id, fileset_id=fileset_id)

fileset_metadata Link

fileset_metadata(scan_id, fileset_id, key=None, **kwargs)

URL to access the fileset metadata associated with the given scan and fileset name.

Parameters:

Name Type Description Default

scan_id Link

str

The name of the scan to access.

required

fileset_id Link

str

The name of the fileset to access.

required

key Link

str or Noe

A specific metadata key to fetch.

None

Other Parameters:

Name Type Description
prefix str

An optional prefix to prepend to the URL path.

Returns:

Type Description
str

The URL path to fileset metadata.

Examples:

>>> from plantdb.commons import api_endpoints
>>> api_endpoints.fileset_metadata('real_plant', 'images')
'/api/v1/filesets/real_plant/images/metadata'
Source code in plantdb/commons/api_endpoints.py
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
@api_prefix
def fileset_metadata(
        scan_id: str, fileset_id: str, key: str | None = None, **kwargs
) -> str:
    """URL to access the fileset metadata associated with the given scan and fileset name.

    Parameters
    ----------
    scan_id : str
        The name of the scan to access.
    fileset_id : str
        The name of the fileset to access.
    key : str or Noe, optional
        A specific metadata key to fetch.

    Other Parameters
    ----------------
    prefix : str
        An optional prefix to prepend to the URL path.

    Returns
    -------
    str
        The URL path to fileset metadata.

    Examples
    --------
    >>> from plantdb.commons import api_endpoints
    >>> api_endpoints.fileset_metadata('real_plant', 'images')
    '/api/v1/filesets/real_plant/images/metadata'
    """
    scan_id = sanitize_name(scan_id)
    fileset_id = sanitize_name(fileset_id)

    # Assemble optional query parameters
    query: dict[str, str] = {}
    if key is not None:
        query["key"] = str(key)

    query_str = f"?{parse.urlencode(query)}" if query else ""
    return FILESET_MD.format(scan_id=scan_id, fileset_id=fileset_id) + f"{query_str}"

health Link

health(**kwargs)

Return the URL path to the health endpoint.

Other Parameters:

Name Type Description
prefix str

An optional prefix to prepend to the URL path.

Returns:

Type Description
str

The URL path to the health endpoint.

Examples:

>>> from plantdb.commons import api_endpoints
>>> api_endpoints.health()
'/api/v1/health'
Source code in plantdb/commons/api_endpoints.py
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
@api_prefix
def health(**kwargs) -> str:
    """Return the URL path to the health endpoint.

    Other Parameters
    ----------------
    prefix : str
        An optional prefix to prepend to the URL path.

    Returns
    -------
    str
        The URL path to the health endpoint.

    Examples
    --------
    >>> from plantdb.commons import api_endpoints
    >>> api_endpoints.health()
    '/api/v1/health'
    """
    return HEALTH

home Link

home(**kwargs)

Return the URL path to the home endpoint.

Other Parameters:

Name Type Description
prefix str

An optional prefix to prepend to the URL path.

Returns:

Type Description
str

The URL path to the home endpoint.

Examples:

>>> from plantdb.commons import api_endpoints
>>> api_endpoints.home()
'/api/v1/'
>>> api_endpoints.home(prefix='/plantdb')
'/plantdb/api/v1/'
Source code in plantdb/commons/api_endpoints.py
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
@api_prefix
def home(**kwargs) -> str:
    """Return the URL path to the home endpoint.

    Other Parameters
    ----------------
    prefix : str
        An optional prefix to prepend to the URL path.

    Returns
    -------
    str
        The URL path to the home endpoint.

    Examples
    --------
    >>> from plantdb.commons import api_endpoints
    >>> api_endpoints.home()
    '/api/v1/'
    >>> api_endpoints.home(prefix='/plantdb')
    '/plantdb/api/v1/'
    """
    return HOME

image Link

image(scan_id, fileset_id, file_id, size=None, as_base64=None, **kwargs)

Return the URL path to the image endpoint.

Parameters:

Name Type Description Default

scan_id Link

str

The name of the scan dataset containing the image.

required

fileset_id Link

str

The name of the fileset containing the image.

required

file_id Link

str

The name of the image.

required

size Link

str or int

The size parameter of the image request.

None

as_base64 Link

bool

A boolean flag indicating whether to return an image as a base64 string.

None

Other Parameters:

Name Type Description
prefix str

An optional prefix to prepend to the URL path.

Returns:

Type Description
str

The URL path to the image endpoint.

Examples:

>>> from plantdb.commons import api_endpoints
>>> api_endpoints.image('real_plant', 'images', '00000_rgb', 'orig', False)
'/api/v1/assets/image/real_plant/images/00000_rgb?size=orig&as_base64=false'
>>> api_endpoints.image('real_plant', 'images', '00000_rgb', 'thumb', True)
'/api/v1/assets/image/real_plant/images/00000_rgb?size=thumb&as_base64=true'
Source code in plantdb/commons/api_endpoints.py
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
@api_prefix
def image(
        scan_id: str,
        fileset_id: str,
        file_id: str,
        size: int | str | None = None,
        as_base64: bool | None = None,
        **kwargs,
) -> str:
    """Return the URL path to the image endpoint.

    Parameters
    ----------
    scan_id : str
        The name of the scan dataset containing the image.
    fileset_id : str
        The name of the fileset containing the image.
    file_id : str
        The name of the image.
    size : str or int, optional
        The size parameter of the image request.
    as_base64 : bool, optional
        A boolean flag indicating whether to return an image as a base64 string.

    Other Parameters
    ----------------
    prefix : str
        An optional prefix to prepend to the URL path.

    Returns
    -------
    str
        The URL path to the image endpoint.

    Examples
    --------
    >>> from plantdb.commons import api_endpoints
    >>> api_endpoints.image('real_plant', 'images', '00000_rgb', 'orig', False)
    '/api/v1/assets/image/real_plant/images/00000_rgb?size=orig&as_base64=false'
    >>> api_endpoints.image('real_plant', 'images', '00000_rgb', 'thumb', True)
    '/api/v1/assets/image/real_plant/images/00000_rgb?size=thumb&as_base64=true'
    """
    scan_id = sanitize_name(scan_id)
    fileset_id = sanitize_name(fileset_id)
    file_id = sanitize_name(file_id)

    # Assemble optional query parameters
    query: dict[str, str] = {}
    if size is not None:
        query["size"] = str(size)
    if as_base64 is not None:
        # Use lower-case JSON-style booleans for consistency
        query["as_base64"] = str(as_base64).lower()

    query_str = f"?{parse.urlencode(query)}" if query else ""
    return (
            IMAGE.format(scan_id=scan_id, fileset_id=fileset_id, file_id=file_id)
            + f"{query_str}"
    )

login Link

login(**kwargs)

Return the URL path to the login endpoint.

Other Parameters:

Name Type Description
prefix str

An optional prefix to prepend to the URL path.

Returns:

Type Description
str

The URL path to the login endpoint.

Examples:

>>> from plantdb.commons import api_endpoints
>>> api_endpoints.login()
'/api/v1/auth/login'
Source code in plantdb/commons/api_endpoints.py
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
@api_prefix
def login(**kwargs) -> str:
    """Return the URL path to the login endpoint.

    Other Parameters
    ----------------
    prefix : str
        An optional prefix to prepend to the URL path.

    Returns
    -------
    str
        The URL path to the login endpoint.

    Examples
    --------
    >>> from plantdb.commons import api_endpoints
    >>> api_endpoints.login()
    '/api/v1/auth/login'
    """
    return LOGIN

logout Link

logout(**kwargs)

Return the URL path to the logout endpoint.

Other Parameters:

Name Type Description
prefix str

An optional prefix to prepend to the URL path.

Returns:

Type Description
str

The URL path to the logout endpoint.

Examples:

>>> from plantdb.commons import api_endpoints
>>> api_endpoints.logout()
'/api/v1/auth/logout'
Source code in plantdb/commons/api_endpoints.py
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
@api_prefix
def logout(**kwargs) -> str:
    """Return the URL path to the logout endpoint.

    Other Parameters
    ----------------
    prefix : str
        An optional prefix to prepend to the URL path.

    Returns
    -------
    str
        The URL path to the logout endpoint.

    Examples
    --------
    >>> from plantdb.commons import api_endpoints
    >>> api_endpoints.logout()
    '/api/v1/auth/logout'
    """
    return LOGOUT

mesh Link

mesh(scan_id, size=None, coords=None, **kwargs)

Return the URL path to the mesh endpoint.

Parameters:

Name Type Description Default

scan_id Link

str

The name of the scan dataset containing the mesh.

required

size Link

str or int

Query parameter controlling downsampling. Accepted values: * 'orig' - serve the original point cloud.

None

coords Link

bool

Query parameter indicating whether to return the vertices coordinates and triangle IDs as JSON. Defaults to 'false', which streams the PLY file.

None

Other Parameters:

Name Type Description
prefix str

An optional prefix to prepend to the URL path.

Returns:

Type Description
str

The URL path to the mesh endpoint.

Examples:

>>> from plantdb.commons import api_endpoints
>>> api_endpoints.mesh('real_plant')
'/api/v1/assets/mesh/real_plant'
>>> api_endpoints.mesh('real_plant', coords=True)
Source code in plantdb/commons/api_endpoints.py
 998
 999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
@api_prefix
def mesh(scan_id: str, size: int | str | None = None, coords: bool | None = None, **kwargs) -> str:
    """Return the URL path to the mesh endpoint.

    Parameters
    ----------
    scan_id : str
        The name of the scan dataset containing the mesh.
    size : str or int, optional
        Query parameter controlling downsampling.
        Accepted values:
            * 'orig' - serve the original point cloud.
    coords : bool, optional
        Query parameter indicating whether to return the vertices coordinates and triangle IDs as JSON.
        Defaults to 'false', which streams the PLY file.

    Other Parameters
    ----------------
    prefix : str
        An optional prefix to prepend to the URL path.

    Returns
    -------
    str
        The URL path to the mesh endpoint.

    Examples
    --------
    >>> from plantdb.commons import api_endpoints
    >>> api_endpoints.mesh('real_plant')
    '/api/v1/assets/mesh/real_plant'
    >>> api_endpoints.mesh('real_plant', coords=True)
    """
    VALID_SIZES = {"orig"}
    scan_id = sanitize_name(scan_id)

    # Assemble optional query parameters
    query: dict[str, str] = {}
    if size is not None:
        if isinstance(size, int):
            query["size"] = str(size)
        elif isinstance(size, str) and size in VALID_SIZES:
            query["size"] = size.lower()
        else:
            raise ValueError(
                f"Invalid size '{size}'. Valid options: integer value or {VALID_SIZES}"
            )
    if coords is not None:
        query["coords"] = str(coords)

    query_str = f"?{parse.urlencode(query)}" if query else ""
    return MESH.format(scan_id=scan_id) + f"{query_str}"

pointcloud Link

pointcloud(scan_id, size=None, coords=None, pcd_type='default', **kwargs)

Return the URL path to the point-cloud endpoint.

Parameters:

Name Type Description Default

scan_id Link

str

The name of the scan dataset containing the point-cloud.

required

size Link

str or int or float

Query parameter controlling downsampling. Accepted values: * 'orig' - serve the original point cloud. * 'preview' - serve a precomputed preview (default). * A float value - perform on-the-fly voxel downsampling using the specified voxel size. If an invalid string is supplied, the default 'preview' is used.

None

coords Link

bool

Query parameter indicating whether to return the point coordinates as JSON. Defaults to 'false', which streams the PLY file. If set, returns the data as a list under the 'coordinates' JSON dictionary entry.

None

pcd_type Link

str or int

Query parameter indicating whether to return the reconstructed point cloud (default) or the ground truth ('type=gt').

'default'

Other Parameters:

Name Type Description
prefix str

An optional prefix to prepend to the URL path.

Returns:

Type Description
str

The URL path to the point-cloud endpoint.

Examples:

>>> from plantdb.commons import api_endpoints
>>> api_endpoints.pointcloud('real_plant')
'/api/v1/assets/pointcloud/real_plant?type=default'
>>> api_endpoints.pointcloud('real_plant', pcd_type='gt')
'/api/v1/assets/pointcloud/real_plant?type=gt'
>>> api_endpoints.pointcloud('real_plant', coords=True)
'/api/v1/assets/pointcloud/real_plant?type=default&coords=True'
Source code in plantdb/commons/api_endpoints.py
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
@api_prefix
def pointcloud(
        scan_id: str,
        size: int | float | str | None = None,
        coords: bool | None = None,
        pcd_type: str = "default",
        **kwargs,
) -> str:
    """Return the URL path to the point-cloud endpoint.

    Parameters
    ----------
    scan_id : str
        The name of the scan dataset containing the point-cloud.
    size : str or int or float, optional
        Query parameter controlling downsampling.
        Accepted values:
            * 'orig' - serve the original point cloud.
            * 'preview' - serve a precomputed preview (default).
            * A float value - perform on-the-fly voxel downsampling using the specified voxel size.
        If an invalid string is supplied, the default 'preview' is used.
    coords : bool, optional
        Query parameter indicating whether to return the point coordinates as JSON.
        Defaults to 'false', which streams the PLY file.
        If set, returns the data as a list under the 'coordinates' JSON dictionary entry.
    pcd_type : str or int, optional
        Query parameter indicating whether to return the reconstructed point cloud (default) or
        the ground truth ('type=gt').

    Other Parameters
    ----------------
    prefix : str
        An optional prefix to prepend to the URL path.

    Returns
    -------
    str
        The URL path to the point-cloud endpoint.

    Examples
    --------
    >>> from plantdb.commons import api_endpoints
    >>> api_endpoints.pointcloud('real_plant')
    '/api/v1/assets/pointcloud/real_plant?type=default'
    >>> api_endpoints.pointcloud('real_plant', pcd_type='gt')
    '/api/v1/assets/pointcloud/real_plant?type=gt'
    >>> api_endpoints.pointcloud('real_plant', coords=True)
    '/api/v1/assets/pointcloud/real_plant?type=default&coords=True'
    """
    VALID_SIZES = {"orig", "preview"}
    VALID_TYPES = ["default", "gt"]
    seq_type = "" if pcd_type not in VALID_TYPES else pcd_type
    scan_id = sanitize_name(scan_id)

    # Assemble optional query parameters
    query: dict[str, str] = {}
    if size is not None:
        if isinstance(size, (int, float)):
            query["size"] = str(size)
        elif isinstance(size, str) and size in VALID_SIZES:
            query["size"] = size.lower()
        else:
            raise ValueError(
                f"Invalid size '{size}'. Valid options: integer value or {VALID_SIZES}"
            )
    if seq_type is not None:
        query["type"] = str(seq_type)
    if coords is not None:
        query["coords"] = str(coords)

    query_str = f"?{parse.urlencode(query)}" if query else ""
    return POINTCLOUD.format(scan_id=scan_id) + f"{query_str}"

refresh Link

refresh(scan_id=None, **kwargs)

Return the URL path to the dataset archive endpoint.

Parameters:

Name Type Description Default

scan_id Link

str or None

The name of the scan dataset to archive.

None

Other Parameters:

Name Type Description
prefix str

An optional prefix to prepend to the URL path.

Returns:

Type Description
str

The URL path to the refresh endpoint.

Examples:

>>> from plantdb.commons import api_endpoints
>>> api_endpoints.refresh()
'/api/v1/refresh'
>>> api_endpoints.refresh('scan1')
'/refresh?scan_id=scan1'
Source code in plantdb/commons/api_endpoints.py
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
@api_prefix
def refresh(scan_id: str | None = None, **kwargs) -> str:
    """Return the URL path to the dataset archive endpoint.

    Parameters
    ----------
    scan_id : str or None, optional
        The name of the scan dataset to archive.

    Other Parameters
    ----------------
    prefix : str
        An optional prefix to prepend to the URL path.

    Returns
    -------
    str
        The URL path to the refresh endpoint.

    Examples
    --------
    >>> from plantdb.commons import api_endpoints
    >>> api_endpoints.refresh()
    '/api/v1/refresh'
    >>> api_endpoints.refresh('scan1')
    '/refresh?scan_id=scan1'
    """
    params = ""
    if scan_id:
        scan_id = sanitize_name(scan_id)
        params = f"?scan_id={scan_id}"
    return f"{REFRESH}{params}"

register Link

register(**kwargs)

Return the URL path to the register endpoint.

Other Parameters:

Name Type Description
prefix str

An optional prefix to prepend to the URL path.

Returns:

Type Description
str

The URL path to the register endpoint.

Examples:

>>> from plantdb.commons import api_endpoints
>>> api_endpoints.register()
'/api/v1/auth/register'
Source code in plantdb/commons/api_endpoints.py
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
@api_prefix
def register(**kwargs) -> str:
    """Return the URL path to the register endpoint.

    Other Parameters
    ----------------
    prefix : str
        An optional prefix to prepend to the URL path.

    Returns
    -------
    str
        The URL path to the register endpoint.

    Examples
    --------
    >>> from plantdb.commons import api_endpoints
    >>> api_endpoints.register()
    '/api/v1/auth/register'
    """
    return REGISTER

scan Link

scan(scan_id, **kwargs)

Return the URL path to the scan endpoint.

Parameters:

Name Type Description Default

scan_id Link

str

The name of the scan to access.

required

Other Parameters:

Name Type Description
prefix str

An optional prefix to prepend to the URL path.

Returns:

Type Description
str

The URL path to the scan endpoint.

Examples:

>>> from plantdb.commons import api_endpoints
>>> api_endpoints.scan('scan1')
'/api/v1/scans/scan1'
Source code in plantdb/commons/api_endpoints.py
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
@api_prefix
def scan(scan_id: str, **kwargs) -> str:
    """Return the URL path to the scan endpoint.

    Parameters
    ----------
    scan_id : str
        The name of the scan to access.

    Other Parameters
    ----------------
    prefix : str
        An optional prefix to prepend to the URL path.

    Returns
    -------
    str
        The URL path to the scan endpoint.

    Examples
    --------
    >>> from plantdb.commons import api_endpoints
    >>> api_endpoints.scan('scan1')
    '/api/v1/scans/scan1'
    """
    scan_id = sanitize_name(scan_id)
    return SCAN.format(scan_id=scan_id)

scan_filesets_list Link

scan_filesets_list(scan_id, **kwargs)

URL to list the filesets associated with the given scan name.

Parameters:

Name Type Description Default

scan_id Link

str

The name of the scan to access.

required

Other Parameters:

Name Type Description
prefix str

An optional prefix to prepend to the URL path.

Returns:

Type Description
str

The URL path to filesets.

Examples:

>>> from plantdb.commons import api_endpoints
>>> api_endpoints.scan_filesets_list('real_plant')
'/api/v1/scans/real_plant/filesets'
Source code in plantdb/commons/api_endpoints.py
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
@api_prefix
def scan_filesets_list(scan_id: str, **kwargs) -> str:
    """URL to list the filesets associated with the given scan name.

    Parameters
    ----------
    scan_id : str
        The name of the scan to access.

    Other Parameters
    ----------------
    prefix : str
        An optional prefix to prepend to the URL path.

    Returns
    -------
    str
        The URL path to filesets.

    Examples
    --------
    >>> from plantdb.commons import api_endpoints
    >>> api_endpoints.scan_filesets_list('real_plant')
    '/api/v1/scans/real_plant/filesets'
    """
    scan_id = sanitize_name(scan_id)
    return SCAN_FILESETS.format(scan_id=scan_id)

scan_metadata Link

scan_metadata(scan_id, key=None, **kwargs)

URL to access the metadata associated with the given scan name.

Parameters:

Name Type Description Default

scan_id Link

str

The name of the scan to access.

required

key Link

str or None

A specific metadata key to fetch.

None

Other Parameters:

Name Type Description
prefix str

An optional prefix to prepend to the URL path.

Returns:

Type Description
str

The URL path to scan metadata.

Examples:

>>> from plantdb.commons import api_endpoints
>>> api_endpoints.scan_metadata('real_plant')
'/api/v1/scans/real_plant/metadata'
Source code in plantdb/commons/api_endpoints.py
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
@api_prefix
def scan_metadata(scan_id: str, key: str | None = None, **kwargs) -> str:
    """URL to access the metadata associated with the given scan name.

    Parameters
    ----------
    scan_id : str
        The name of the scan to access.
    key : str or None, optional
        A specific metadata key to fetch.

    Other Parameters
    ----------------
    prefix : str
        An optional prefix to prepend to the URL path.

    Returns
    -------
    str
        The URL path to scan metadata.

    Examples
    --------
    >>> from plantdb.commons import api_endpoints
    >>> api_endpoints.scan_metadata('real_plant')
    '/api/v1/scans/real_plant/metadata'
    """
    scan_id = sanitize_name(scan_id)

    # Assemble optional query parameters
    query: dict[str, str] = {}
    if key is not None:
        query["key"] = str(key)

    query_str = f"?{parse.urlencode(query)}" if query else ""
    return SCAN_MD.format(scan_id=scan_id) + f"{query_str}"

scans Link

scans(**kwargs)

Return the URL path to the scans' endpoint.

Other Parameters:

Name Type Description
prefix str

An optional prefix to prepend to the URL path.

Returns:

Type Description
str

The URL path to the scans' endpoint.

Examples:

>>> from plantdb.commons import api_endpoints
>>> api_endpoints.scans()
'/api/v1/scans'
Source code in plantdb/commons/api_endpoints.py
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
@api_prefix
def scans(**kwargs) -> str:
    """Return the URL path to the scans' endpoint.

    Other Parameters
    ----------------
    prefix : str
        An optional prefix to prepend to the URL path.

    Returns
    -------
    str
        The URL path to the scans' endpoint.

    Examples
    --------
    >>> from plantdb.commons import api_endpoints
    >>> api_endpoints.scans()
    '/api/v1/scans'
    """
    return SCANS

scans_info Link

scans_info(**kwargs)

Return the URL path to the list of scan dataset information endpoint.

Other Parameters:

Name Type Description
prefix str

An optional prefix to prepend to the URL path.

Returns:

Type Description
str

The URL path to the list of scan dataset information endpoint.

Examples:

>>> from plantdb.commons import api_endpoints
>>> api_endpoints.scans_info()
'/api/v1/scans/info'
Source code in plantdb/commons/api_endpoints.py
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
@api_prefix
def scans_info(**kwargs) -> str:
    """Return the URL path to the list of scan dataset information endpoint.

    Other Parameters
    ----------------
    prefix : str
        An optional prefix to prepend to the URL path.

    Returns
    -------
    str
        The URL path to the list of scan dataset information endpoint.

    Examples
    --------
    >>> from plantdb.commons import api_endpoints
    >>> api_endpoints.scans_info()
    '/api/v1/scans/info'
    """
    return SCANS_INFO

sequence Link

sequence(scan_id, seq_type=None, **kwargs)

Return the URL path to the sequence endpoint.

Parameters:

Name Type Description Default

scan_id Link

str

The name of the scan dataset containing the angles and internodes sequence.

required

seq_type Link

str

The type of measure to request, in ['all', 'angles', 'internodes', 'fruit_points', 'manual_angles', 'manual_internodes'].

None

Other Parameters:

Name Type Description
prefix str

An optional prefix to prepend to the URL path.

Returns:

Type Description
str

The URL path to the angles and internodes sequences endpoint.

Examples:

>>> from plantdb.commons import api_endpoints
>>> api_endpoints.sequence('real_plant','all')
'/api/v1/assets/sequence/real_plant?type=all'
Source code in plantdb/commons/api_endpoints.py
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
@api_prefix
def sequence(scan_id: str, seq_type: str | None = None, **kwargs) -> str:
    """Return the URL path to the sequence endpoint.

    Parameters
    ----------
    scan_id : str
        The name of the scan dataset containing the angles and internodes sequence.
    seq_type : str, optional
        The type of measure to request, in ``['all', 'angles', 'internodes', 'fruit_points',
         'manual_angles', 'manual_internodes']``.

    Other Parameters
    ----------------
    prefix : str
        An optional prefix to prepend to the URL path.

    Returns
    -------
    str
        The URL path to the angles and internodes sequences endpoint.

    Examples
    --------
    >>> from plantdb.commons import api_endpoints
    >>> api_endpoints.sequence('real_plant','all')
    '/api/v1/assets/sequence/real_plant?type=all'
    """
    valid_types = [
        "all",
        "angles",
        "internodes",
        "fruit_points",
        "manual_angles",
        "manual_internodes",
    ]
    seq_type = "all" if seq_type not in valid_types else seq_type
    scan_id = sanitize_name(scan_id)

    # Assemble optional query parameters
    query: dict[str, str] = {}
    if seq_type is not None:
        query["type"] = str(seq_type)

    query_str = f"?{parse.urlencode(query)}" if query else ""
    return SEQUENCE.format(scan_id=scan_id) + f"{query_str}"

skeleton Link

skeleton(scan_id, **kwargs)

Return the URL path to the skeleton endpoint.

Parameters:

Name Type Description Default

scan_id Link

str

The name of the scan dataset containing the skeleton.

required

Other Parameters:

Name Type Description
prefix str

An optional prefix to prepend to the URL path.

Returns:

Type Description
str

The URL path to the skeleton endpoint.

Examples:

>>> from plantdb.commons import api_endpoints
>>> api_endpoints.skeleton('real_plant')
'/api/v1/assets/skeleton/real_plant'
Source code in plantdb/commons/api_endpoints.py
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
@api_prefix
def skeleton(scan_id: str, **kwargs) -> str:
    """Return the URL path to the skeleton endpoint.

    Parameters
    ----------
    scan_id : str
        The name of the scan dataset containing the skeleton.

    Other Parameters
    ----------------
    prefix : str
        An optional prefix to prepend to the URL path.

    Returns
    -------
    str
        The URL path to the skeleton endpoint.

    Examples
    --------
    >>> from plantdb.commons import api_endpoints
    >>> api_endpoints.skeleton('real_plant')
    '/api/v1/assets/skeleton/real_plant'
    """
    scan_id = sanitize_name(scan_id)
    return SKELETON.format(scan_id=scan_id)

timelapse Link

timelapse(timelapse_id, **kwargs)

Return the URL path to the timelapse endpoint.

Parameters:

Name Type Description Default

timelapse_id Link

str

The identifier of the timelapse to access.

required

Other Parameters:

Name Type Description
prefix str

An optional prefix to prepend to the URL path.

Returns:

Type Description
str

The URL path to the timelapse endpoint.

Examples:

>>> from plantdb.commons import api_endpoints
>>> api_endpoints.timelapse('tl1')
'/api/v1/timelapses/tl1'
Source code in plantdb/commons/api_endpoints.py
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
@api_prefix
def timelapse(timelapse_id: str, **kwargs) -> str:
    """Return the URL path to the timelapse endpoint.

    Parameters
    ----------
    timelapse_id : str
        The identifier of the timelapse to access.

    Other Parameters
    ----------------
    prefix : str
        An optional prefix to prepend to the URL path.

    Returns
    -------
    str
        The URL path to the timelapse endpoint.

    Examples
    --------
    >>> from plantdb.commons import api_endpoints
    >>> api_endpoints.timelapse('tl1')
    '/api/v1/timelapses/tl1'
    """
    timelapse_id = sanitize_name(timelapse_id)
    return TIMELAPSE.format(timelapse_id=timelapse_id)

timelapse_scans Link

timelapse_scans(timelapse_id, sort=None, **kwargs)

Return the URL path to the timelapse member scans endpoint.

Parameters:

Name Type Description Default

timelapse_id Link

str

The identifier of the timelapse to access.

required

sort Link

str

Sort parameter, e.g. 'timelapse.scheduled'.

None

Other Parameters:

Name Type Description
prefix str

An optional prefix to prepend to the URL path.

Returns:

Type Description
str

The URL path to the timelapse member scans endpoint.

Examples:

>>> from plantdb.commons import api_endpoints
>>> api_endpoints.timelapse_scans('tl1')
'/api/v1/timelapses/tl1/scans'
Source code in plantdb/commons/api_endpoints.py
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
@api_prefix
def timelapse_scans(timelapse_id: str, sort: str | None = None, **kwargs) -> str:
    """Return the URL path to the timelapse member scans endpoint.

    Parameters
    ----------
    timelapse_id : str
        The identifier of the timelapse to access.
    sort : str, optional
        Sort parameter, e.g. 'timelapse.scheduled'.

    Other Parameters
    ----------------
    prefix : str
        An optional prefix to prepend to the URL path.

    Returns
    -------
    str
        The URL path to the timelapse member scans endpoint.

    Examples
    --------
    >>> from plantdb.commons import api_endpoints
    >>> api_endpoints.timelapse_scans('tl1')
    '/api/v1/timelapses/tl1/scans'
    """
    timelapse_id = sanitize_name(timelapse_id)
    raw = TIMELAPSE_SCANS.format(timelapse_id=timelapse_id)
    if sort:
        raw = f"{raw}?{parse.urlencode({'sort': sort})}"
    return raw

timelapses Link

timelapses(**kwargs)

Return the URL path to the timelapses' endpoint.

Other Parameters:

Name Type Description
prefix str

An optional prefix to prepend to the URL path.

Returns:

Type Description
str

The URL path to the timelapses' endpoint.

Examples:

>>> from plantdb.commons import api_endpoints
>>> api_endpoints.timelapses()
'/api/v1/timelapses'
Source code in plantdb/commons/api_endpoints.py
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
@api_prefix
def timelapses(**kwargs) -> str:
    """Return the URL path to the timelapses' endpoint.

    Other Parameters
    ----------------
    prefix : str
        An optional prefix to prepend to the URL path.

    Returns
    -------
    str
        The URL path to the timelapses' endpoint.

    Examples
    --------
    >>> from plantdb.commons import api_endpoints
    >>> api_endpoints.timelapses()
    '/api/v1/timelapses'
    """
    return TIMELAPSES

token_refresh Link

token_refresh(**kwargs)

Return the URL path to the token refresh endpoint.

Other Parameters:

Name Type Description
prefix str

An optional prefix to prepend to the URL path.

Returns:

Type Description
str

The URL path to the token refresh endpoint.

Examples:

>>> from plantdb.commons import api_endpoints
>>> api_endpoints.token_refresh()
'/api/v1/auth/token/refresh'
Source code in plantdb/commons/api_endpoints.py
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
@api_prefix
def token_refresh(**kwargs) -> str:
    """Return the URL path to the token refresh endpoint.

    Other Parameters
    ----------------
    prefix : str
        An optional prefix to prepend to the URL path.

    Returns
    -------
    str
        The URL path to the token refresh endpoint.

    Examples
    --------
    >>> from plantdb.commons import api_endpoints
    >>> api_endpoints.token_refresh()
    '/api/v1/auth/token/refresh'
    """
    return TOKEN_REFRESH

token_validation Link

token_validation(**kwargs)

Return the URL path to the token validation endpoint.

Other Parameters:

Name Type Description
prefix str

An optional prefix to prepend to the URL path.

Returns:

Type Description
str

The URL path to the token validation endpoint.

Examples:

>>> from plantdb.commons import api_endpoints
>>> api_endpoints.token_validation()
'/api/v1/auth/token/validation'
Source code in plantdb/commons/api_endpoints.py
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
@api_prefix
def token_validation(**kwargs) -> str:
    """Return the URL path to the token validation endpoint.

    Other Parameters
    ----------------
    prefix : str
        An optional prefix to prepend to the URL path.

    Returns
    -------
    str
        The URL path to the token validation endpoint.

    Examples
    --------
    >>> from plantdb.commons import api_endpoints
    >>> api_endpoints.token_validation()
    '/api/v1/auth/token/validation'
    """
    return TOKEN_VALIDATION