Need to run an API from a script and extract fields from output of API | Unix Linux Forums | Shell Programming and Scripting

  Go Back    

Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

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

Shell Programming and Scripting

Closed Thread    
Thread Tools Search this Thread Display Modes
Old 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
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
Sponsored Links
Old 12-03-2012
jim mcnamara jim mcnamara is offline Forum Staff  
Join Date: Feb 2004
Last Activity: 30 January 2015, 4:22 PM EST
Location: NM
Posts: 10,360
Thanks: 313
Thanked 838 Times in 778 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
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 09:22 PM
How to use getdiskbyname() API alert0919 HP-UX 0 02-15-2009 02:15 AM
shell / bash / script api ? Turrican Shell Programming and Scripting 5 12-11-2008 05:39 PM
API question q30 AIX 0 08-02-2004 05:03 AM

All times are GMT -4. The time now is 04:33 AM.