Trying to export job XML via API results in "Could not resolve view with name 'apiJobsExportv14'"

25 views
Skip to first unread message

James Hodgins

unread,
Oct 19, 2022, 3:04:03 PM10/19/22
to rundeck-discuss
I'm trying to call the API to export my jobs as XML and getting:
[2022-10-19T18:48:17,316] WARN  server.HttpChannel [qtp204364500-24] - /api/41/project/TestProject/jobs/export
javax.servlet.ServletException: Could not resolve view with name 'apiJobsExportv14' in servlet with name 'grailsDispatcherServlet'

Server is running from a war file.
RUNDECK
APIVERSION : 41
BASE : /opt/rundeck
BUILD : 4.6.1-20220914
BUILDGIT : v4.6.1-0-gc78ff2c
NODE : localhost
SERVERUUID : 14localhost
VERSION : 4.6.1-20220914

URI I'm trying against is http://localhost:4440/api/41/project/TestProject/jobs/export?idlist=dfc47d12-13bb-4a69-83e3-148bde72b16a .  I've tried without the idlist parameter as well.  Import is working fine.

rac...@rundeck.com

unread,
Oct 19, 2022, 3:34:43 PM10/19/22
to rundeck-discuss

Hi, could you share your call to check?

I tested successfully with the following one:

curl -s -X GET -H "X-Rundeck-Auth-Token: HazN5mfF4XJGDAnRy8uO0yr9CgPNcnbw" -H "Accept: application/xml" "http://localhost:4440/api/41/project/ProjectEXAMPLE/jobs/export?idlist=db1130ab-cbeb-40fd-93a4-a29c6c6bec31"

The output print would be saved in a file, something like:

curl -s -X GET -H "X-Rundeck-Auth-Token: HazN5mfF4XJGDAnRy8uO0yr9CgPNcnbw" -H "Accept: application/xml" "http://localhost:4440/api/41/project/ProjectEXAMPLE/jobs/export?idlist=db1130ab-cbeb-40fd-93a4-a29c6c6bec31" > myjob.xml

Regards!

James Hodgins

unread,
Oct 19, 2022, 5:04:23 PM10/19/22
to rundeck...@googlegroups.com
Mine is in Powershell, but would be: ($_RundeckSession.WebSession is the headers and other session info from the call to j_security_check)

Invoke-RestMethod -WebSession $_RundeckSession.WebSession -Method 'GET' -Uri 'http://localhost:4440/api/41/project/TestProject/jobs/export?idlist=dfc47d12-13bb-4a69-83e3-148bde72b16a' -Headers @{'Accept'='application/xml'} -ContentType 'application/xml'

I tested again with an API token and that works ok for me.

Invoke-RestMethod -Method 'GET' -Uri 'http://localhost:4440/api/41/project/TestProject/jobs/export?idlist=dfc47d12-13bb-4a69-83e3-148bde72b16a' -Headers @{'X-Rundeck-Auth-Token'='H3gTUobAGJClj1N5mYdbT3jFmgkx2XU8';'Accept'='application/xml'} -ContentType 'application/xml'

--
You received this message because you are subscribed to a topic in the Google Groups "rundeck-discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/rundeck-discuss/9Fy7JeETuos/unsubscribe.
To unsubscribe from this group and all its topics, send an email to rundeck-discu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rundeck-discuss/d482e1c5-29a0-4b95-adb4-91aa1fb79cfan%40googlegroups.com.


--
James Hodgins
WebMD Health Services
TechOps

rac...@rundeck.com

unread,
Oct 20, 2022, 8:37:22 AM10/20/22
to rundeck-discuss
Great,

An excellent way to avoid that kind of problem is to use a tool like Postman or ThunderClient (a Visual Studio Code extension), these solutions allow you to export any API call in any format (cURL, Powershell, Javascript, etc..).

Regards!
Reply all
Reply to author
Forward
0 new messages