function _invoice_api_view_json in Invoice 7
Displays the specified invoice in JSON format
Parameters
integer $invoiceId:
1 call to _invoice_api_view_json()
- _invoice_api_invoice_get in ./
invoice_api.inc - Handles GET request for the specified invoice ID
File
- ./
invoice_api.inc, line 538
Code
function _invoice_api_view_json($invoiceId) {
$nid = db_query("SELECT nid FROM {invoice_invoices} WHERE iid = :invoiceId", array(
':invoiceId' => $invoiceId,
))
->fetchField();
$invoiceModel = new InvoiceRestModel();
$node = node_load($nid);
$invoiceModel
->mapFromNode($node);
_invoice_api_http_response_code(200);
// OK
echo json_encode($invoiceModel
->getArrayCopy());
}