API Call Unauthorized for Running a Job

1,436 views
Skip to first unread message

Stefano Pirrello

unread,
Feb 21, 2016, 8:31:03 AM2/21/16
to rundeck-discuss
Hi,

Can someone provide some guidance on the use of the API calls?  I'm getting the following error message when trying to run a job.  I've looked around on several postings and usually this is related to the permissions of the API token ACL however the permissions I've configured allow for full access to the API group.

Please help.


Script:
#!/usr/bin/python
import sys
import time
import json
import requests


payload = {'Content-Type' : 'application/json', 'X-Rundeck-Auth-Token':'asdfasdflkasdjflkjasdlfjsd', 'argString' : 'opt.LB AT4D-F5 opt.ServerName TESTSVR opt.Server-IP 192.168.100.123', 'loglevel':'INFO', 'asUser': 'adminguy', ''}



print r.text
print r.headers


API Token ACL:

description: api_token_group, all access.
context:
  application: 'rundeck'
for:
  resource:
    - allow: '*' # allow create of projects
  project:
    - allow: '*' # allow view/admin of all projects
by:
  group: admin

description: Full access.
context:
  project: '.*' # all projects
for:
  resource:
    - allow: '*' # allow read/create all kinds
  adhoc:
    - allow: '*' # allow read/running/killing adhoc jobs
  job:
    - allow: '*' # allow read/write/delete/run/kill of all jobs
  node:
    - allow: '*' # allow read/run for all nodes
by:
  group: [api_token_group]

---

description: Admin, all access.
context:
  application: 'rundeck'
for:
  resource:
    - allow: '*' # allow create of projects
  project:
    - allow: '*' # allow view/admin of all projects
by:
  group: [api_token_group]


Error message:


<result error='true' apiversion='14'><error code='unauthorized'><message>(unauthenticated) is not authorized for: /api/1/job/78fd78a1-eaa5-4c55-9de0-48d191b00a56/run</message></error></result>



Alex Honor

unread,
Feb 22, 2016, 7:34:43 PM2/22/16
to rundeck...@googlegroups.com
Hi Stefano,

The error message is showing that "unauthenticated" is not authorized. Not too sure about that code but double check you are setting an HTTP header for X-Rundeck-Auth-Token and not passing parameters.

Thanks

--
You received this message because you are subscribed to the Google Groups "rundeck-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rundeck-discu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rundeck-discuss/ba74bb42-07e2-452b-87ac-712f4647c685%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--

Alex Honor

[SimplifyOps, Inc | a...@simplifyops.com ]

Be sure to comment and vote on Rundeck Feature Development!

Stefano Pirrello

unread,
Feb 25, 2016, 10:35:32 AM2/25/16
to rundeck-discuss
Figured out the problem.  I needed to use the "headers" parameter vs. "data", see below.

Reply all
Reply to author
Forward
0 new messages