Moab Web Services > Resources > Accounting > Accounting Funds

Accounting Funds

This section describes the services available through Moab Web Services for interacting with the Fund object in Moab Accounting Manager. It contains the URLs, request bodies, and responses delivered to and from MWS as an intermediary for MAM.

The Fields: Funds, Fields: Fund Balances, Fields: Fund Statements, and Fields: Fund Statement Summary reference sections contain the type and description of the default fields in the Fund object as well as related objects and reports given in the URLs below.

Supported methods

Resource GET PUT POST DELETE
/rest/accounting/funds Get All Funds -- -- --
/rest/accounting/funds/<id> Get Single Fund -- -- --
/rest/accounting/funds/balances Get All Fund Balances -- -- --
/rest/accounting/funds/reports/statement Get Fund Statement -- -- --
/rest/accounting/funds/reports/statement/summary Get Fund Statement Summary -- -- --

This topic contains these sections:

Getting Funds

The HTTP GET method is used to retrieve Fund information.

Quick reference

GET http://localhost:8080/mws/rest/accounting/funds?api-version=3
GET http://localhost:8080/mws/rest/accounting/funds/<id>?api-version=3
GET http://localhost:8080/mws/rest/accounting/funds/balances?api-version=3
GET http://localhost:8080/mws/rest/accounting/funds/reports/statement?api-version=3
GET http://localhost:8080/mws/rest/accounting/funds/reports/statement/summary?api-version=3

Get All Funds

URLs and parameters

GET http://localhost:8080/mws/rest/accounting/funds?api-version=3&proxy-user=<user>[&active=true][&filter=<filter_options>[&filter-type=<filter_type>]][&query=<query_conditions>][&fields=<fields_to_display>[&sort=<fields_to_sort>]|&show-all=(true|false)]
Parameter Required Type Description Example
proxy-user Yes String Perform action as defined MAM user. proxy-user=amy
active No Boolean Lists only active or non-active allocations of the fund. The fund amount becomes the sum of the active/inactive allocations. active=true
filter No JSON Query funds based on defined MAM filter. filter={"account":"chemistry"}
filter-type No String Query funds based on defined MAM filter type. filter-type=NonExclusive
query No JSON

Results are restricted to those having the specified field values.

The query parameter does not support the full Mongo query syntax. Only querying for a simple, non-nested JSON object is allowed.

query={"priority":"2","allocation.active":"false"}
fields No String Comma-separated list of field names to display. fields=id,name,amount
sort No JSON Sort the results. Use 1 for ascending and -1 for descending. Should be used in conjunction with the fields parameter. sort={"id":1}
show-all No Boolean (true or false) true shows all fields including metadata and hidden fields. Default is false. show-all=true

See Global URL Parameters for available URL parameters.

Sample response

GET http://localhost:8080/mws/rest/accounting/funds?api-version=3&proxy-user=amy&fields=id,name,amount&pretty=true
------------------------------------

{
  "totalCount": 2,
  "resultCount": 2,
  "results":   [
        {
      "id": 1,
      "name": "biology",
      "amount": 50000000
    },
        {
      "id": 2,
      "name": "chemistry",
      "amount": 99727
    }
  ]
}

Get Single Fund

URLs and parameters

GET http://localhost:8080/mws/rest/accounting/funds/<id>?api-version=3&proxy-user=<user>[&active=(true|false)][&fields=<fields_to_display>|&show-all=(true|false)]
Parameter Required Type Description Example
id Yes String The unique identifier of the object --
proxy-user Yes String Perform action as defined MAM user. proxy-user=amy
active No Boolean Lists only active or non-active allocations of the fund. The fund amount becomes the sum of the active/inactive allocations. active=true
fields No String Comma-separated list of field names to display. fields=id,name,amount
show-all No Boolean (true or false) true shows all fields including metadata and hidden fields. Default is false. show-all=true

See Global URL Parameters for available URL parameters.

Sample response

GET http://localhost:8080/mws/rest/accounting/funds/1?api-version=3&proxy-user=amy&pretty=true
------------------------------------

{
  "id": 1,
  "name": "biology",
  "priority": 0,
  "defaultDeposit": 50000000,
  "description": "",
  "amount": 50000000,
  "allocated": 50000000,
  "initialDeposit": 50000000,
  "creditLimit": 0,
  "allocations":   [
        {
      "id": 1,
      "startTime": "2013-08-21 16:57:53 UTC",
      "endTime": "infinity",
      "amount": 50000000,
      "creditLimit": 0,
      "initialDeposit": 50000000,
      "allocated": 50000000,
      "active": false,
      "description": ""
    }
  ],
  "fundConstraints": [  {
    "id": 1,
    "name": "Account",
    "value": "biology"
  }]
}

Get All Fund Balances

URLs and parameters

GET http://localhost:8080/mws/rest/accounting/funds/balances?api-version=3&proxy-user=<user>[&filter=<filter_options>][&filter-type=<filter_type>]
Parameter Required Type Description Example
proxy-user Yes String Perform action as defined MAM user. proxy-user=amy
filter No JSON Query funds based on defined MAM filter. filter={"account":"chemistry"}
filter-type No String Query funds based on defined MAM filter type. filter-type=NonExclusive

See Global URL Parameters for available URL parameters.

Sample response

The fund balances resource is an aggregation of fund data. For more information, see the Fields: Fund Balances reference section.

GET http://localhost:8080/mws/rest/accounting/funds/balances?api-version=3&proxy-user=amy&pretty=true
------------------------------------

{
  "totalCount": 2,
  "resultCount": 2,
  "results": [
    {
      "id": 2,
      "name": 1204,
      "priority": 0,
      "description": "R&D for Manufacturing",
      "creationTime": "2012-02-02 09:34:42 UTC",
      "amount": 9060000,
      "deposited": 9060000,
      "creditLimit": 0,
      "reserved": 0,
      "allocations": [
        {
          "id": 2,
          "amount": 9060000,
          "creditLimit": 0,
          "deposited": 9060000
        }
      ],
      "fundConstraints": [
        {
          "id": 2,
          "name": "CostCenter",
          "value": 1204
        }
      ],
      "balance": 9060000,
      "available": 9060000,
      "allocated": 9060000,
      "used": 0,
      "percentRemaining": 100,
      "percentUsed": 0
    },
    {
      "id": 5,
      "name": "",
      "priority": 0,
      "description": "",
      "creationTime": "2012-04-03 09:25:47 UTC",
      "amount": 901290219001,
      "deposited": 901290219021,
      "creditLimit": 30,
      "reserved": 84018308897.68,
      "allocations": [
        {
          "id": 6,
          "amount": 901290219001,
          "creditLimit": 30,
          "deposited": 901290219021
        }
      ],
      "fundConstraints": [],
      "balance": 817271910103.32,
      "available": 817271910133.32,
      "allocated": 901290219051,
      "used": 20,
      "percentRemaining": 100,
      "percentUsed": 0
    }
  ]
}

Get Fund Statement

URLs and parameters

GET http://localhost:8080/mws/rest/accounting/funds/reports/statement?api-version=3&proxy-user=<user>[&filter=<filter_options>][&filter-type=<filter_type>][&start-time=<date_string>][&end-time=<date_string>][&context=<context>]
Parameter Required Type Description Example
proxy-user Yes String Perform action as defined MAM user. proxy-user=amy
filter No JSON Query funds based on defined MAM filter. filter={"account":"chemistry"}
filter-type No String Query funds based on defined MAM filter type. filter-type=NonExclusive
start-time No Date, -infinity, or now Filter allocations and transaction after a start time. start-time=2012-04-03 15:24:39 UTC
end-time No Date, -infinity, or now Filter allocations and transactions before an end time. end-time=2012-04-03 15:24:39 UTC
context No hpc or cloud

The context to use in Moab Accounting Manager.

The context parameter overrides the default context set for MAM using the mam.context configuration parameter. For more information about this parameter, see Configuration.

context=hpc

See Global URL Parameters for available URL parameters.

Sample response

The fund statement report provides a snapshot of the current funds. For more information, see Fields: Fund Statements.

GET http://localhost:8080/mws/rest/accounting/funds/reports/statement?api-version=3&proxy-user=amy&fields=startBalance,endBalance&pretty=true
------------------------------------

{
  "startBalance":1234.01,
  "endBalance":1000
}

Get Fund Statement Summary

URLs and parameters

GET http://localhost:8080/mws/rest/accounting/funds/reports/statement/summary?api-version=3&proxy-user=<user>[&filter=<filter_options>][&filter-type=<filter_type>][&start-time=<date_string>][&end-time=<date_string>]
Parameter Required Type Description Example
proxy-user Yes String Perform action as defined MAM user. proxy-user=amy
filter No JSON Query funds based on defined MAM filter. filter={"account":"chemistry"}
filter-type No String Query funds based on defined MAM filter type. filter-type=NonExclusive
start-time No Date, -infinity, or now Filter allocations and transaction after a start time. start-time=2012-04-03 15:24:39 UTC
end-time No Date, -infinity, or now Filter allocations and transactions before an end time. end-time=2012-04-03 15:24:39 UTC

See Global URL Parameters for available URL parameters.

Sample response

The fund statement summary is slightly different from the typical fund statement in that the transactions are provided as summaries grouped by object and action. For more information, see Fields: Fund Statement Summary.

GET http://localhost:8080/mws/rest/accounting/funds/reports/statement/summary?api-version=3&proxy-user=amy&fields=totalCredits,totalDebits,transactions.action,transactions.amount,transactions.count&pretty=true
------------------------------------

{
  "totalCredits":200.02,
  "totalDebits":-100,
  "transactions":[ {
      "action":"Deposit",
      "amount":200.02,
      "count":2
    }, {
      "action":"Charge",
      "amount":-100,
      "count":1
    }
  ]
}

Related Topics 

© 2015 Adaptive Computing