Unix/Linux Go Back    

Shell Programming and Scripting BSD, Linux, and UNIX shell scripting Post awk, bash, csh, ksh, perl, php, python, sed, sh, shell scripts, and other shell scripting languages questions here.

Need to run an API from a script and extract fields from output of API

Shell Programming and Scripting

Thread Tools Search this Thread Display Modes
Old Unix and Linux 12-03-2012
rkrish rkrish is offline
Registered User
Join Date: Sep 2011
Last Activity: 29 July 2013, 8:43 AM EDT
Posts: 71
Thanks: 11
Thanked 0 Times in 0 Posts
Unix or Linux Question Need to run an API from a script and extract fields from output of API

I need to call an API (GetUsageDetails)from inside a shell script which takes an input argument acct_nbr.

The output of API will be like :

<usageAccum accumId="450" accumCaptn="PM_125" inclUnits="1410.00" inclUnitsUsed="744.00" shared="true" pooled="false" prorated="false" realtimeSbscrpShared="false" bonusFlag="false" inclUnitsRolledOver="0.00" maxRolloverUnits="0.00" inclUnitsToBeRolledOver="0.00" rolloverAvailableFlag="false" prevCycleReleasedFlag="false" sbscrpUsedUnits="729.00">

and I need to fetch the marked fields from the output.
Can anyone help me how to acheive this in shell scripting...I have no idea of how to run an API from a shell script Linux
Sponsored Links
Old Unix and Linux 12-03-2012
jim mcnamara jim mcnamara is offline Forum Staff  
Join Date: Feb 2004
Last Activity: 27 October 2016, 9:37 AM EDT
Location: NM
Posts: 10,841
Thanks: 451
Thanked 972 Times in 903 Posts
An API is basically a code library, written in some language like C and then presented as some kind of an object for other compiled languages to use.

bash is not a compiled language. You will have to write some kind of wrapper in C or java or whatever the api is meant to interface with.
Sponsored Links

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Linux More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
API in C for compress (.Z) ? domiq44 Programming 4 02-01-2011 08:22 PM
How to use getdiskbyname() API alert0919 HP-UX 0 02-15-2009 01:15 AM
shell / bash / script api ? Turrican Shell Programming and Scripting 5 12-11-2008 04:39 PM
API question q30 AIX 0 08-02-2004 04:03 AM

All times are GMT -4. The time now is 10:45 AM.