Skip to content

Get Image-Related Resources



POST /api/v1/workspace/{workspace_uuid}/get_logo_url

Overview

Get the Logo or favicon URL for the specified workspace, filename, and language. Returns an empty string if the resource does not exist.

Prerequisites and Usage Steps

  1. Use an External API signing account with workspace read permission, and obtain the workspace UUID from content.data[*].uuid in the response of the Workspace List.
  2. Query by the filename and language used at upload time; you can also omit both to use the default values. The POST request has no request body. Calculate the signature as described in Signature Description.
  3. If an empty URL is returned, verify the workspace, filename, and language, and confirm that the file has been uploaded. The query does not write any resource.

Path Parameters

Parameter Name Type Required Description
workspace_uuid string Y Workspace UUID
Example: wksp_example
How to obtain or specify: Obtain it from content.data[*].uuid in the Workspace List.

Request Headers

Parameter Name Type Required Description
X-Df-SVersion string Signature version. The example below uses v20240417.
Example: v20240417
How to obtain or specify: Enter it as shown in the example, corresponding to the signature algorithm.
X-Df-Access-Key string Y Request AK information
Example: <access-key>
How to obtain or specify: Assigned by the External API administrator.
X-Df-Signature string Y Signature information
Example: <hex-signature>
How to obtain or specify: Concatenate POST, nonce, the request path and raw query string, the timestamp, and the empty body in that order, then compute HMAC-SHA256 with the Secret Key and take the hexadecimal result.
X-Df-Timestamp string Y Timestamp of the request
Example: 1785456000
How to obtain or specify: Enter the current Unix seconds at call time, for example by running date +%s.
X-Df-Nonce string Y Temporary code generated at request time
Example: b53b47e12e514616ad8cb1f17cb66dce
How to obtain or specify: Generate a new random value for each request, for example uuid.uuid4().hex.

Query Parameters

Parameter Name Type Required Description
filename string Filename
Allowed values: ['logo.png', 'favicon.ico']
Example: logo.png
How to obtain or specify: Enter the target filename used at upload time; defaults to logo.png if omitted.
language string Language
Allowed values: ['zh', 'en', 'zh-hant', 'id', 'ja', 'ko']
Example: zh
How to obtain or specify: Enter the language used at upload time; defaults to zh if omitted. If the resource does not exist, it does not fall back to another language.

Request Example

import hashlib
import hmac
import os
import time
import uuid

import requests

endpoint = os.environ["DF_EXTERNAL_ENDPOINT"].rstrip("/")
path = "/api/v1/workspace/wksp_example/get_logo_url?filename=logo.png&language=zh"
timestamp = str(int(time.time()))
nonce = uuid.uuid4().hex
to_sign = " ".join(("POST", nonce, path, timestamp, ""))
signature = hmac.new(os.environ["DF_EXTERNAL_SECRET_KEY"].encode(), to_sign.encode(), hashlib.sha256).hexdigest()
try:
    response = requests.post(endpoint + path, headers={
        "X-Df-Access-Key": os.environ["DF_EXTERNAL_ACCESS_KEY"],
        "X-Df-Signature": signature,
        "X-Df-Timestamp": timestamp,
        "X-Df-Nonce": nonce,
        "X-Df-SVersion": "v20240417",
    }, timeout=30)
except requests.RequestException:
    print('Request result unknown. Verify the current state of the target and whether the write has already occurred before deciding whether to re-sign and retry; do not automatically repeat write requests.')
    raise SystemExit(1)
if not 200 <= response.status_code < 300:
    print("HTTP", response.status_code, response.text)  # Preserve errorCode, content, and traceId; do not output AK/SK.
    raise SystemExit(1)
print(response.json()["content"]["url"])

Response

HTTP 200, application/json.

Field Type Description
content.url string Resource URL; empty string when no file corresponds to the workspace, filename, and language.
{
    "code": 200,
    "content": {
        "url": "https://static.example.com/logo/wksp_example_logo.png"
    },
    "errorCode": "",
    "message": "",
    "success": true,
    "traceId": "TRACE-EXAMPLE"
}
{"code":200,"content":{"url":""},"errorCode":"","message":"","success":true,"traceId":"TRACE-EXAMPLE"}

Error Response

For authentication, rate limiting, and common request errors, see Common Error Definitions.

A missing resource is handled as a successful response. Authentication, signature, rate limiting, and request validation errors are handled according to the common error definitions.

HTTP Status errorCode Trigger Condition Message or Response Description Resolution
406 ft.ParameterValidationFailed filename or language is outside the allowed range The message indicates the field that failed enumeration validation. Use the filenames and languages listed in the parameter table.

Feedback

Is this page helpful?