Unix/Linux Go Back    


Shell Programming and Scripting Unix shell scripting - KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and 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 Linux or Unix Question    
 
Thread Tools Search this Thread Display Modes
    #1  
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

Hi,
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 :

Code:
<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
    #2  
Old Unix and Linux 12-03-2012
jim mcnamara jim mcnamara is online now Forum Staff  
...@...
 
Join Date: Feb 2004
Last Activity: 30 June 2015, 3:19 PM EDT
Location: NM
Posts: 10,494
Thanks: 344
Thanked 869 Times in 807 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 Linux or Unix Question

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 03:43 PM.