Page 1 of 1

agnUID -> customer_id ?

Posted: Mon Sep 12, 2011 1:35 pm
by apoman
hi,

how do i get the internal customer_id (at the database) when only having the agnUID ????

THANK YOU!
micha

Re: agnUID -> customer_id ?

Posted: Wed Nov 14, 2012 4:47 pm
by seanpsullivan68
the agnUID is simply a base36 encoded representation that includes the following:

Company_ID
Mailing_ID
Customer_ID
URL_ID
Signature_ID

here is a quick perl diddy to decode:

Code: Select all

#!/usr/bin/perl

use Math::Base36 ':all';

my $agnUID = 'PLACE agnUID Here';

my ($company_id, $mailing_id, $customerID, $url_id, $signature) =  split(/./, $agnUID);
my @values =  split(/\./, $agnUID);
my $b36 = '1h';
my $counter = 0;

foreach my $b36(@values){
        $number = decode_base36( $b36 );
        if ($counter == 0 ){
                print "Company_ID = $number" . "\n";
        }elsif($counter == 1){
                print "Mailing_ID = $number" . "\n";
        }elsif($counter == 2){
                print "Customer_ID  = $number" . "\n";
        }elsif($counter == 3){
                print "URL_ID  = $number" . "\n";
        }elsif($counter == 4){
                print "Signature_ID  = $number" . "\n";
        }else{
                print $number . "\n";
        }
        $counter++;
}

Re: agnUID -> customer_id ?

Posted: Thu Aug 29, 2013 8:38 am
by Fatalin
There is a website you can use for the base36 conversion as well:

http://www.translatorscafe.com/cafe/uni ... o-base-36/

Markus

Re: agnUID -> customer_id ?

Posted: Thu Aug 29, 2013 9:27 pm
by Anton
Have a look at the agn python module. There is a method parseUID(uidstr) that does what you want in a nice python way.

Code: Select all

uid = agn.UID ()
uid.parseUID (uidstr)
There is a method in bavd.py:

Code: Select all

def __scanUID (self, uidstr):
This should give you everything you need if you want to do it in another language. I'm using python so just included agn and it works great.
Cheers.