0
 <script>
    var URL = 'https://firebasedynamiclinks.googleapis.com/v1/shortLinks?key=MY_KEY'
    const req = new Request(URL,{
        method : "POST",
        headers : new Headers({
            "Content-Type" : "application/json"
        }),
        context: {
            "longDynamicLink" : "https://MY_DOMAIN.page.link/?link=EXAMPLE_LINK",
            "suffix" : {
                "option" : "SHORT"
            }
        }
    });
var response = fetch(req).then(res=>res.json()).then(json => console.log(JSON.stringify(json)));
    </script>

I want to make shortlink. My longDynamiclink is working so I send request, but I received the following response.

{code: 400

message: "Unsupported dynamic link request DYNAMICLINK_NOT_SET.[https://firebase.google.com/docs/dynamic-links/rest#create_a_short_link_from_parameters]"

status: "INVALID_ARGUMENT"}

Is there a problem with my code? Or did I make the wrong request? Please let me know how I can fix my code to get the correct response.

thanks.

KENdi
  • 7,576
  • 2
  • 16
  • 31
john
  • 56
  • 12
  • I would guess there is a good chance its an encoding issue with the long link. Can you check the the EXAMPLE_LINK is URL encoded properly (or try a very simple link to test with)? If you can share more details of specific request, that would help as well. – Ian Barber Oct 02 '18 at 00:46

1 Answers1

0

Check this out first:

  1. Make sure that you've already added the SHA1 and SHA256 certificate fingerprint to your Firebase Project Configuration
  2. Enable "Firebase Dynamic Links API" for your project at console.cloud.google.com console
dev.for.fun
  • 1,198
  • 8
  • 22