FORMAT: 1A

# Group Vectorapi
Group of all vectorapi-related resources.

## Hfa Invoice

The Hfa Invoice resource is used to fetch Hfa Invoice data as well as approve and void an Invoice

## Index with sort params [/vectorapi/hfainvoice/index{?limit,offset,sortBy,sortOrder}]

### Index [GET]

+ Parameters

    + limit (optional, number,`5`)
    + offset (optional, number,`1`)
    + sortBy (optional, varchar,`hfaInvoicePeriod`)
    + sortOrder (optional, varchar,`desc`)

+ Request JSON Message
    
    + Headers

            Accept: application/json

+ Response 200 (application/json)

    + Body
{
  "envelope": {
    "header": {
      "apiVersion": "1.0",
      "baseUrl": "192.168.0.45",
      "httpStatusCode": 200
    },
    "request": "hfainvoice/index?params=vectorapi&hfainvoice&index&json&5&<some_token>&1&hfaInvoicePeriod&desc",
    "response": {
      "hfaInvoiceData": [
        {
          "invoiceId": "145",
          "hfaSourceFile": "M16106_INVBKP_011213_NOI_00025797_20140922_REVISED2.TXT",
          "md5": "8a82ebad40fe8482802a7231923d42eb",
          "paymentStatus": "ingested",
          "createdDate": "2014-09-25 17:38:34",
          "modifiedDate": null,
          "hfaPeriodCode": "011213",
          "royaltyType": "NOI-HFA Pubs",
          "frequencyType": "Monthly",
          "approvedBy": "0"
        },
        {
          "invoiceId": "146",
          "hfaSourceFile": "M16106_INVBKP_011213_NOI_00025797_20140922_REVISED2.TXT",
          "md5": "8a82ebad40fe8482802a7231923d42eb",
          "paymentStatus": "approved",
          "createdDate": "2014-09-25 17:38:34",
          "modifiedDate": "2014-09-25 17:40:34",
          "hfaPeriodCode": "011213",
          "royaltyType": "NOI-Non-HFA Pubs",
          "frequencyType": "Quarterly",
          "approvedBy": "0"
        },
        {
          "invoiceId": "149",
          "hfaSourceFile": "M16106_INVBKP_011213_NOI_00025797_20140922_REVISED2.TXT",
          "md5": "8a82ebad40fe8482802a7231923d42eb",
          "paymentStatus": "ingested",
          "createdDate": "2014-09-25 17:38:34",
          "modifiedDate": null,
          "hfaPeriodCode": "011213",
          "royaltyType": "NOI-HFA Pubs",
          "frequencyType": "Monthly",
          "approvedBy": "0"
        }
      ],
      "totalRecords": "26901"
    }
  }
}



## Index with search params [/vectorapi/hfainvoice/index{?searchBy,searchValue}]

### Index [GET]

+ Parameters

    + searchBy (optional, varchar,`hfaInvoiceId`)
    + searchValue (optional, varchar,`234`)

+ Request JSON Message
    
    + Headers

            Accept: application/json

+ Response 200 (application/json)

    + Body
{
  "envelope": {
    "header": {
      "apiVersion": "1.0",
      "baseUrl": "192.168.0.45",
      "httpStatusCode": 200
    },
    "request": "hfainvoice/index?params=vectorapi&hfainvoice&index&json&hfaPeriodCode&011013&<some_token>",
    "response": {
      "hfaInvoiceData": [
        {
          "invoiceId": "145",
          "hfaSourceFile": "M16106_INVBKP_011213_NOI_00025797_20140922_REVISED2.TXT",
          "md5": "8a82ebad40fe8482802a7231923d42eb",
          "paymentStatus": "ingested",
          "createdDate": "2014-09-25 17:38:34",
          "modifiedDate": null,
          "hfaPeriodCode": "011213",
          "royaltyType": "NOI-HFA Pubs",
          "frequencyType": "Monthly",
          "approvedBy": "0"
        },
        {
          "invoiceId": "146",
          "hfaSourceFile": "M16106_INVBKP_011213_NOI_00025797_20140922_REVISED2.TXT",
          "md5": "8a82ebad40fe8482802a7231923d42eb",
          "paymentStatus": "approved",
          "createdDate": "2014-09-25 17:38:34",
          "modifiedDate": "2014-09-30 18:40:14",
          "hfaPeriodCode": "011213",
          "royaltyType": "NOI-Non-HFA Pubs",
          "frequencyType": "Quarterly",
          "approvedBy": "0"
        },
        {
          "invoiceId": "149",
          "hfaSourceFile": "M16106_INVBKP_011213_NOI_00025797_20140922_REVISED2.TXT",
          "md5": "8a82ebad40fe8482802a7231923d42eb",
          "paymentStatus": "ingested",
          "createdDate": "2014-09-25 17:38:34",
          "modifiedDate": "2014-04-15 20:48:28",
          "hfaPeriodCode": "011213",
          "royaltyType": "NOI-HFA Pubs",
          "frequencyType": "Monthly",
          "approvedBy": "0"
        }
      ],
      "totalRecords": "14508"
    }
  }
}


+ **Optional Parameters**

    + searchBy (fields: hfaInvoiceId,trackId,statementDetailId,hfaPeriodCode,paymentStatus,approvedBy)
    + searchValue
    + limit
    + offset
    + sortBy (fields: frequencyType,paymentStatus,received,hfaInvoicePeriod,invoiceType) 
    + sortOrder - direction in which to order the data

## Put [/vectorapi/hfainvoice/put]

To update hfa invoice data.

### Put [PUT]

+ Request JSON Message
    
    + Headers

            Accept: application/json
    + Body
{
  "hfaInvoiceId": 234,
  "invoiceStatus": "void",
  "approvedBy" : 105
}

+ Response 200 (application/json)

    + Body
{
  "envelope": {
    "header": {
      "apiVersion": "1.0",
      "baseUrl": "vapi.orchard",
      "httpStatusCode": 200
    },
    "request": "/vectorapi/hfainvoice/put",
    "response": {
      "hfa_invoice": 234
    }
  }
}
