0

I created a javascript function that tries to update the destination URL of bitly. Working fine for updating Title and Tag except for long_url. Please share if anyone has a solution.

Example code:

  const UpdateURL = async() => {
try{
  return await fetch('https://api-ssl.bitly.com/v4/bitlinks/bit.ly/3FphReM', {
    method: 'PATCH',
    headers: {
        'Authorization': 'Bearer {Token}',
        'Content-Type': 'application/json'
    },
    body: JSON.stringify({ 

      "id": "bit.ly/3FphReM", 
      "title": "Test 1", 
      "long_url": "https://dev.mysite.com", //Not updating this URL
      "tags": [ "test1" ], 
    })
    });
} catch (e){
  return e;
}



}
    const call = ()=> {
        const Res = UpdateURL();
        console.log("Res---",Res);
    }

Id: bit.ly/3FphReM

Expected Result: The long_url should update

Elavarasan r
  • 1,055
  • 2
  • 12
  • 22

0 Answers0