0
votes

I'm brand new to Firebase and having the most basic issue. I can't seem to get a basic api call to work to create a dynamic link. I'm just trying to create a shortened url with no android/ios references.

Here is my api call:

POST:  https://firebasedynamiclinks.googleapis.com/v1/shortLinks?key=[apiKey]
BODY:  {
   "longDynamicLink": "https://mycustomsubdomain.page.link/?link=https://docs.google.com"
}

I get the following error message:

 {
  "error": {
    "code": 400,
    "message": "Invalid JSON payload received. Unknown name \"{\n   \"longDynamicLink\": \"https://mycustomsubdomain.page.link/?link\": Cannot bind query parameter. Field '{\n   \"longDynamicLink\": \"https://mycustomsubdomain' could not be found in request message.",
    "status": "INVALID_ARGUMENT",
    "details": [
      {
        "@type": "type.googleapis.com/google.rpc.BadRequest",
        "fieldViolations": [
          {
            "description": "Invalid JSON payload received. Unknown name \"{\n   \"longDynamicLink\": \"https://mycustomsubdomain.page.link/?link\": Cannot bind query parameter. Field '{\n   \"longDynamicLink\": \"https://mycustomsubdomain' could not be found in request message."
          }
        ]
      }
    ]
  }
}
1

1 Answers

1
votes

I asume you use REST API?

Try this (without BODY):

POST https://firebasedynamiclinks.googleapis.com/v1/shortLinks?key=api_key
Content-Type: application/json

{
   "longDynamicLink": "https://example.page.link/?link=https://www.example.com/&apn=com.example.android&ibi=com.example.ios"
}