Page 1 of 1

Trigger Jobs with REST API

Posted: 01 Sep 2017, 14:45
by DirkDittmar
Hi,

first of all I have to admit that I'm absolutely new to Aimeos and I'm not very good at PHP. So sorry if this is a stupid question. I'm using 2017.07.4 (core) with Slim 3.8.1 and PHP 7.0 ...

I have to trigger the jobs through a REST API.

I've looked at

Code: Select all

jobs.php
and of cause I looked at

Code: Select all

\Aimeos\Slim\Command\Jobs
. My idea was to do something like the

Code: Select all

\Aimeos\Slim\Command\Jobs::execute()
method. The problem is that I can not get the required objects.

Any idea welcome :)


Regards,

Dirk

Re: Trigger Jobs with REST API

Posted: 03 Sep 2017, 08:13
by aimeos
You will get into maximum execution time problems if you execute the jobs from a web environment. Instead, you should store the job requests in a file or the database and execute the jobs by a cronjob regularly depending on the stored requests.

Re: Trigger Jobs with REST API

Posted: 03 Sep 2017, 09:07
by DirkDittmar
Maybe I missunderstand your answer.
But I can not execute cronjobs on the server. So I have to trigger them on a different way.

Re: Trigger Jobs with REST API

Posted: 04 Sep 2017, 08:46
by aimeos
You can copy the jobs.php file and remove the check for the CLI environment. But be careful to protect the new script by HTTP auth or something similar. Otherwise, everybody can execute all jobs.