Skip to main content

Decode URL

The decodeUrl() function is used to decode a URL and retrieve information about the content it represents, such as Open Graph (OG) tags. You can then use those tags to build Link Previews inside the feed.

Steps to Decode URL

  1. Build a DecodeUrlRequest object using the DecodeUrlRequestBuilder class.

  2. Call the decodeUrl() function using the instance of the LMFeedClient class.

  3. Use the response as per your requirement.

     // Provide the URL to be decoded
    String urlToDecode = "https://example.com"; // replace with the actual URL

    // Build the request object
    DecodeUrlRequest request = (DecodeUrlRequestBuilder()
    ..url(urlToDecode))
    .build();

    // Get the response from calling the function
    final DecodeUrlResponse response = await lmFeedClient.decodeUrl(request);

    // Process the response, as per requirement
    if(response.success){
    // your function to handle successful URL decoding
    handleDecodedUrl(response);
    }else{
    // your function to handle error message
    handleDecodedUrlError(response.errorMessage);
    }
tip

Decoding a URL can provide valuable information about the content it points to, including OG tags for better content presentation.

Models

DecodeUrlRequest

List of parameters for the DecodeUrlRequest class

VariableTypeDescriptionOptional
urlStringURL to be decoded

DecodeUrlResponse

List of parameters for the DecodeUrlResponse class

VariableTypeDescriptionOptional
successboolAPI success status
errorMessageStringError message in case of failure
ogTagsOgTagsOpen Graph tags for the decoded content