PHP and JSON (API)

168 views Asked by At

What is going wrong I'm trying to make an api between exactonline and autotask. I'm already linked to the database between these, but now I do not come any further to transfer the data between these two.

Script

script1(exactOnline)

try {
    $result = array();
    $journals = new \Picqer\Financials\Exact\Journal($connection);
    $result   = $journals->get();
    foreach ($result as $journal) {
       $result[]= $journal->Description;
    }
    echo json_encode($result);
} catch (\Exception $e) {
    json_encode(array(get_class($e) . ' : ' . $e->getMessage()));
}

script2(exactOnline)

namespace Picqer\Financials\Exact;

/**
 * Class Journal
 *
 * @package Picqer\Financials\Exact
 * @see https://start.exactonline.nl/docs/HlpRestAPIResourcesDetails.aspx?name=financialJournals
 *
 * @property String $Code BIC code of the bank where the bank account is held
 * @property Int32 $Division Division code
 * @property String $Description Description of BankAccount
 * @property Guid $ID Primary Key
 * @property String $Type Bank account number. Is mandatory for Journals that have Type = Bank
 */
class Journal extends Model
{
    use Query\Findable;
    use Persistance\Storable;

    protected $fillable = [
        'Code',
        'Division',
        'Description',
        'ID',
        'Type',
    ];

    protected $url = 'financial/Journals';
}

Output

[{"Code":"10","Description":"Kasboek","Division":1741496,"ID":"846af4e2-209d-44aa-84f2-068ae65b69b5","Type":10},{"Code":"90","Description":"Memoriaal","Division":1741496,"ID":"91fc95a4-765e-4d8b-8271-63884be5e480","Type":90},{"Code":"95","Description":"Activamutaties","Division":1741496,"ID":"8ec1491e-51a4-46b8-87f0-a3134c83af4c","Type":90},{"Code":"60","Description":"Inkoopboek","Division":1741496,"ID":"11b1d819-4cdc-4f8c-9d60-aac2359c230b","Type":22},{"Code":"20","Description":"Bank","Division":1741496,"ID":"f8afe3cc-bcf1-4932-9fe0-b761ad48618f","Type":12},{"Code":"70","Description":"Verkoopboek","Division":1741496,"ID":"b4afe081-7f6b-46c7-9742-ea22302a4d55","Type":20},"Kasboek","Memoriaal","Activamutaties","Inkoopboek","Bank","Verkoopboek"]

Question My question is how can I get for example Kasboek as an input in my Autotask script input like this so i can post it >

$ticket->AccountID = 'Kasboek';
$ticket->DueDateTime = '2015-12-17';
0

There are 0 answers