bitly API used by Fabrik is becoming deprecated

ontarget

Active Member
Hi I use Fabrik to generate bitly links, bitly informed me that the API currently used by fabrik is becoming deprecated in March 2020 and will need to use V4

Dear Bitly Customer,

Our records indicate your organization is still actively generating Bitly links through one or more previous versions of the Bitly API. Please be aware that these older, deprecated versions of the Bitly API (v2, v3) will stop working as of March 1, 2020.

Make the transition to API v4 before connections to your older APIs are terminated. Click here to learn more and get started.

Your organization may be making calls to an older version of the Bitly API via your own integration or through a third-party integration that uses the Bitly API. In both cases, a failure to migrate to API v4 by the March 1 deadline will cause your API calls to stop working. Version 4.0.0 (V4) of the Bitly API takes advantage of the latest API standards, with reduced complexity, improved documentation, and decreased levels of effort for integrations.

The final sunset date for V3 and earlier APIs is less than 1 month away. If you’ve not started, we urge you to begin your move to API v4 immediately to avoid any disruptions in your Bitly-supported services.
Is there plans to update the bitly plugin please?
 
I hope that there is a plan in future for Fabric to update the API and libraries that have been deprecated like "bitly api" , "input mask library" and "PHPExcel library"
 
Hi Fabrik team,
If there are no plans to update the bitly API please let me know either way as i will have to think of an alternative for my system and this could take me 2 weeks.
Do i need to take out a sub for the update?
Thanks
 
I am posting my code which i used to bitlyfy a url generated from a fabrik form.
All the elements are encoded into the url and then bitlyfied.
I am using a calc element and the bitly library from /components/com_fabrik/libs/bitly/bitly.php
As you can see the use of bitly is very important as the $fullUrl generated is about 3km long! so I would dearly like a response from Fabrik on any plans to update the bitly API or if there is another solution I could use for URL shortening?

PHP:
$db = JFactory::getDBO();
$tr_table = $db->quoteName('aaa_edcentres');
$eircode = $db->quoteName('eircode');
$ec = '{___venue_education_centre}';
if ($ec == "OTHER") {
  $ecName = '{___venue_other}';
  $ecEircode = '{___venue_other_eircode}';
} else {
  $ecName = '{___venue_education_centre}';
  $query = "SELECT $eircode FROM $tr_table WHERE `edcentre_title` = \"$ec\"";
  $db->setQuery($query);
  $ecEircode = $db->loadResult();
}



$fullUrl = 'http://xxxxx.eu/index.php?option=com_fabrik&view=form&formid=1' .
'&aaa_participant_claim___uniqueclaim_id='. urlencode('{___course_id}') .
'&aaa_participant_claim___category=' . urlencode('{___category_raw}') .
'&aaa_participant_claim___course_title=' . urlencode('{___course_title}') .
'&aaa_participant_claim___course_code=' . urlencode('{___enter_course_code}') .
'&aaa_participant_claim___applysess=' . urlencode('{___apply_sess}') .
'&aaa_participant_claim___allow_overnight=' . urlencode('{___allow_overnight}') .
'&aaa_participant_claim___venue=' . urlencode($ecName).
'&aaa_participant_claim___course_start_date=' . urlencode('{___enter_course_date}') .
'&aaa_participant_claim___claim_process=' . urlencode('{___edcentre_email}') .
'&aaa_participant_claim___edcentre_id=' . urlencode('{___edcentreid}') .
'&aaa_participant_claim___edcentre_process=' . urlencode('{___education_centre}').
'&aaa_participant_claim___venue_ec=' . urlencode($ecEircode);

require_once JPATH_SITE . '/components/com_fabrik/libs/bitly/bitly.php';
         $bitly = new bitly('xxxxmyUsername', 'xxxmyAPIkeyxxxx');
        
             
          // bitlify it
         $url = (string) $bitly->shorten($fullUrl);
        
         return $url;
 
If there are no plans by Fabrik to upgrade to bitly v4 then yourls can be used
https://github.com/YOURLS/YOURLS/releases
I used a calc element then used the yourls api call to shorten my link - works just grand!
PHP:
$username = 'xxxxx';
$password = 'xxxxx';

// EDIT THIS: the query parameters
$url     = 'http://xxxxx/index.php?option=com_fabrik&view=form&formid=1' .
'&aaa_participant_claim___uniqueclaim_id='. urlencode('{___course_id}') .
'&aaa_participant_claim___category=' . urlencode('{___category_raw}') .
'&aaa_participant_claim___course_title=' . urlencode('{___course_title}') .
'&aaa_participant_claim___course_code=' . urlencode('{___enter_course_code}') .
'&aaa_participant_claim___applysess=' . urlencode('{___apply_sess}') .
'&aaa_participant_claim___allow_overnight=' . urlencode('{___allow_overnight}') .
'&aaa_participant_claim___venue=' . urlencode($ecName).
'&aaa_participant_claim___course_start_date=' . urlencode('{___enter_course_date}') .
'&aaa_participant_claim___claim_process=' . urlencode('{___edcentre_email}') .
'&aaa_participant_claim___edcentre_id=' . urlencode('{___edcentreid}') .
'&aaa_participant_claim___edcentre_process=' . urlencode('{___education_centre}').
'&aaa_participant_claim___venue_ec=' . urlencode($ecEircode);  // URL to shrink

$format  = 'simple';                       // output format: 'json', 'xml' or 'simple'

// EDIT THIS: the URL of the API file
$api_url = 'http://xxxxxx/yourls/yourls-api.php';

// Init the CURL session
$ch = curl_init();
curl_setopt( $ch, CURLOPT_URL, $api_url );
curl_setopt( $ch, CURLOPT_HEADER, 0 );            // No header in the result
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true ); // Return, do not echo result
curl_setopt( $ch, CURLOPT_POST, 1 );              // This is a POST request
curl_setopt( $ch, CURLOPT_POSTFIELDS, array(      // Data to POST
      'url'      => $url,
        'keyword'  => $keyword,
        'title'    => $title,
        'format'   => $format,
        'action'   => 'shorturl',
        'username' => $username,
        'password' => $password
    ) );

// Fetch and return content
$data = curl_exec($ch);
curl_close($ch);

// return the result - either ajax calc or on save.
return $data;
 
It will need to be a funded project, so if anyone is interested in funding the development, pm me. We will take a look and get an estimate on what it will take. Thanks!
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top