Hello,
It's not possible to create a view from the API, since the views are part of the Hudson config.xml itself, it seems that the createItem URL doesn't match the need as it looks designed to create the new config.xml for a dedicated job.
The REST API could be some thing like:
GET http://myserver:8080/view (All views)
GET http://myserver:8080/view/myView (switch to Specific view - myView)
POST http://myserver:8080/view (Create new view as defined in the posted XML)
Can you please have a look?
Thanks and regards,
Julien
- is related to
-
JENKINS-23172 Config file provided via the REST api is missing "owner" tags
-
- Open
-
-
JENKINS-9264 Create a new job into a view via REST API
-
- Open
-
- links to
It is possible to create a view, though it's a bit complicated:
{"name": "ViewX", "mode": "hudson.model.ListView"}wget --post-data='name=ViewX&mode=hudson.model.ListView&json=
' http://.../jenkins/createView
Both parameters "name" and "mode" are required twice, as POST parameter and in the json argument. If one is missing, Jenkins responds with "400 Bad Request".
I think this URL is not meant to be used as remote REST API, but it actually can.
I would suggest to fix the problem above, so that either POST parameters can be used or a JSON snippet can be posted.