Thanks Thomas, see below
On 14 Jan 2018, at 17:32, Thomas Mortagne
<thomas.mortagne(a)xwiki.com> wrote:
On Sun, Jan 14, 2018 at 11:57 AM, Vincent Massol <vincent(a)massol.net> wrote:
Hi guys,
I’m trying to use the Job REST API but the doc is pretty poor at
http://www.xwiki.org/xwiki/bin/view/Documentation/UserGuide/Features/XWikiR…
For example to execute a job it says that you only need to pass a “jobType” described as
"The type of the job to pass to the Job Executor” … errr what’s the type and what are
the valid values? Would be nice to have some example too.
The type is the same job type you have in the Job module document
ation at
http://extensions.xwiki.org/xwiki/bin/view/Extension/Job+Module#HUseanexist….
i.e. the hint of the Job component you want to execute, it's not
possible to give a list of those types.
It’s possible to give examples. That would already help a lot.
Also it doesn’t mention any payload that I have
to send but I guess I need to describe the job that I need to execute. What’s the format?
This API document is quite JAX-RS oriented so you can see the class
you would send in Java in the "Accepted Media types:" section, here
it's JobRequest (complete name being
org.xwiki.rest.model.jaxb.JobRequest).
Sure but this is not very explicit for users reading the documentation. You shouldn’t have
to read the source code to be able to use the REST API IMO.
It also says:
“
Since 9.2RC1 jobs started trough the REST API automatically get their runtime context
injected with the following REST HTTP request context properties:
• current wiki
• current user
• request URL and parameters
“
What if I want to specify the wiki, user for ex? How do I do that?
Keep in mind you are not reading an Extension module documentation but
a Job module one.
I didn’t understand this remark.
The namespace(s) where you want to install extensions is indicated in
the job request in case of install job.
Ok
Yes will need to add a few examples. In the meantime you can see how
the JAX-RS XML of an install request looks by asking for the
/jobstatus/ of some previous installed extension.
Thanks, FTR I got the following for the FAQ extension:
URL:
http://localhost:8080/xwiki/rest/jobstatus/extension/action/org.xwiki.contr…
Result:
https://gist.github.com/vmassol/e553ce36b24fbb59d1110e256ab5954f
Now I need to figure what’s the minimal list of properties that I have to pass… There
seems to be a lot:
* extensions
* extensions.excluded
* rewriter
* extension.properties
* rootModificationsAllowed
* caller.reference
* interactive
* checkrights
* context.action
* user.reference
* context.wiki
* namespaces
There seems to be some duplication.
For example the user used to install the extension is defined in:
* extension.properties (as a String)
* user.reference (as a serialized reference)
Whether the job is interactive or not:
* <interactive>true</interactive>
* And also in the “interactive” property
Any idea about what’s the minimum I need to pass?
Thanks
-Vincent
Could someone help improve the doc so that I can try to use it?
Thanks!
-Vincent
--
Thomas Mortagne