MFK Validation - Developer Documentation


The standard way to programatically interact with the MFK web-application is to use the HTTP protocol to submit a MFK number to this webapp and parse the response that is returned (this web-application provides a simpler output format that is easier to parse for just this purpose - which is explained below). You can use any language that can create sockets and speak the HTTP protocol to use this method.

HTTP Query

This documentation assumes that you understand the basics of making HTTP requests (including requests that contain form information). If not, then I suggest the following book:

Web Client Programming with Perl by Clinton Wong
O'Reilly & Associates ISBN 1-56592-214-X

You can make an HTTP GET (or POST - but GET is typically easier) request that will call this MFK webapp and return the results back in the form of a web page (albeit a simple text based page).

The following URL shows how you would need to make such a request (this is a single string, it is broken here just for readability).

    https://apps.its.uiowa.edu/mfk/api-single.jsp
      ?mfk=10%20%20%202604350644010000000000602652020100000000

This would return an text page (MIME type is text/plain) containing two lines. The first line contains a number indicating the validity of the MFK that you supplied (1 for success, 0 for failure, or -1 if there was an error in making the request).

The second line contains a text message that indicates information about the MFK if it is valid or if the MFK is invalid a message indicating why. Last if the MFK request could not be made to the mainframe and -1 was returned, the second line should contain a message explaining the problem.

For example, the above query would return the following:

    1
    VALID MFK

The MFK webapp expects two fields to be passed in (although the date field is optional, and if it is omitted, the webapp checks the MFK based on today's date).

Here is a small example perl program that uses the Perl LWP library to call this web-application and validate a MFK number. This example is perhaps overly simplistic, but it should give you the idea.

#!/usr/local/bin/perl

use LWP;

my $webapp   = "https://apps.its.uiowa.edu/mfk/api-single.jsp";
my $mfk      = "10%20%20%202604350644010000000000602652020100000000";
my $query    = "$webapp?mfk=$mfk";
my $ua       = new LWP::UserAgent;
my $request  = new HTTP::Request( "GET", $query );
my $response = $ua->request( $request );

($valid, $message) = (split( /\n/, $response->content() ));

if( $valid eq "1" ) {
   print "Valid! - $message\n";
} elsif( $valid eq "0" ) {
   print "Invalid! - $message\n";
} else {
   print "Error! - $message\n";
}

In addition, the URL below does the same thing as the api-single URL but also returns description fields.

    https://apps.its.uiowa.edu/mfk/api-singleDesc.jsp
      ?mfk=10%20%20%202604350644010000000000602652020100000000

The above query would return the following:

    1
Valid MFK
{GRANT=Not Assigned, FUND=Stores Srvcs Revolving Dpt Svc, IACT=Travel Out State Fac and Staff, FUNCTION=Not Assigned,
 DEPT=ITS Admin Information Systems, ORG=Information Technology Service, COSTCENTER=Not Assigned}

You can certainly do something similar with other languages (C, C++, Java, TCL, etc...). The details how to do it in other languages would probably depend mostly on the HTTP library that you use.

This is an example of how to program MFK validation into C#.net. It was provided by Harrison Gladden of ITS Enterprise Services.


MFK Web Validator v4.0 last updated on February 22, 2013 by ITS