agnUID -> customer_id ?

Use this forum for questions regarding adoption and functionality of OpenEMM

Moderator: moderator

apoman
Posts: 8
Joined: Fri May 18, 2007 8:33 pm

agnUID -> customer_id ?

Post by apoman »

hi,

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

THANK YOU!
micha
seanpsullivan68
Posts: 1
Joined: Wed Nov 14, 2012 4:39 pm

Re: agnUID -> customer_id ?

Post 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++;
}
Fatalin
Posts: 111
Joined: Wed Aug 05, 2009 10:51 am
Location: Troisdorf, Germany
Contact:

Re: agnUID -> customer_id ?

Post 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
Günstige Software gibt es bei http://www.Software-Butler.de
Anton
Posts: 46
Joined: Sun Jun 24, 2012 9:58 pm

Re: agnUID -> customer_id ?

Post 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.
Post Reply