/expand-shortened-url

This endpoint is used to expand a shortened URL to its original form. Users can provide a shortened URL, and the endpoint will return the full, expanded URL.

Endpoint

POST https://node.nodetrigger.com/expand-shortened-url

JSON Body Parameters

  • url (string, required): The shortened URL that you want to expand.

Response

  • expandedUrl (string): The original, expanded URL.

Error Responses

  • 400 Bad Request: Returned if the url parameter is missing or if the provided URL is invalid.
  • Example: { "error": "Missing URL parameter" }
  • Example: { "error": "Invalid shortened URL" }
  • 500 Internal Server Error: Returned if there is an error while expanding the shortened URL.
  • Example: { "error": "Error expanding shortened URL", "message": "Detailed error message" }

Example Requests

Example 1: Expanding a Valid Shortened URL

Request:

curl -X POST https://node.nodetrigger.com/expand-shortened-url \
-H "Content-Type: application/json" \
-d '{"url": "https://bit.ly/3h1dFQk"}'

Response:

{
  "expandedUrl": "https://www.example.com/original-url"
}

Example 2: Missing URL Parameter

Request:

curl -X POST https://node.nodetrigger.com/expand-shortened-url \
-H "Content-Type: application/json" \
-d '{}'

Response:

{
  "error": "Missing URL parameter"
}

Example 3: Invalid Shortened URL

Request:

curl -X POST https://node.nodetrigger.com/expand-shortened-url \
-H "Content-Type: application/json" \
-d '{"url": "https://bit.ly/invalid"}'

Response:

{
  "error": "Invalid shortened URL"
}