Ask Your Question
0

how to make a get call to chef server from postman

asked 2015-07-23 02:15:19 -0500

jason764 gravatar image

updated 2015-07-28 10:16:57 -0500

smaffulli gravatar image

I tried making a get call to my chef server from post man with basic auth

get call url:

https://10.XXX.XXX.195:443/organizations/XXX/

Header:

X-Ops-Timestamp: 2014-12-12T17:13:28Z
X-Ops-Content-Hash: 2jmj7l5rgtrrgtrgfasfgSw0ygaVb/vlWAggghYkK/YBtwk=
X-Ops-Authorization-1: BE3NnBritishaf3ifuwLSPCgCYaXaRN5oZbtrg4c6hbW0aefI
X-Ops-Authorization-2: sL4j1qtEZzi/2WeF67Uuytdttsdgb5CjgECQwqrym9gCUON
X-Ops-Authorization-3: yf0p7PrLRCNasdfaHhQ2LWStea+kTcdkasdfvaTghfCDC57
X-Ops-Authorization-4: 155i+ZlthfasfasdffukusbIUGBKggUYhbvcds3k0i0gqs+V
X-Ops-Authorization-5: /sLcR7JjQky7sdafIHNfsBQrISktNer1236hbFIayFBx3
X-Ops-Authorization-6: nodilAGMb166@haC/fttwlWggN1LasdqqGomRedtyhSqXA==
Host: api.opscode.com:443
X-Ops-Server-API-Info: 1
X-Chef-Version: 12.0.2
User-Agent: Chef Knife/12.0.2 (ruby-2.1.1-p320; ohai-8.0.0; x86_64-darwin12.0.2; +http://chef.io)
Authorization: Basic c3RldmVkYgtgtgWhYhmMxMjM=

the call is unsuccessful with a 401 error-- {"error":["Invalid signature for user or client 'jason'"]}

edit retag flag offensive close merge delete

Comments

And what is the problem with that ? hint : tell us more, so that someone can actually help you...

vincent-legoll gravatar imagevincent-legoll ( 2015-07-27 10:06:40 -0500 )edit

1 answer

Sort by ยป oldest newest most voted
2

answered 2015-07-28 04:36:26 -0500

updated 2015-07-30 06:21:53 -0500

401 means Unauthorized Access. It means that the credentials you are passing to access the resource are not valid or if they are then the signature that the API call requires is invalid. Please see in detail what the API call needs, see these few things

  1. The format of API call i,e. GET, POST, PUT etc
  2. How you are passing authentication credentials, i,e are you using basic auth or any Oauth mechanism
  3. See required Parameters, whether it requires parameters in URL or in headers or in JSON request

If you properly pass on this information it would return a proper response. Otherwise, share screenshots or details mentioning the situation.

EDITED:

To debug authentication problems, determine which chef-client is attempting to authenticate. This is often found in the log messages for that chef-client. Debug logging can be enabled on a chef-client using the following command:

$ chef-client -l debug

When debug logging is enabled, a log entry will look like the following:

`[Wed, 05 Oct 2011 22:05:35 +0000] DEBUG: Signing the request as NODE_NAME`
If the authentication request occurs during the initial chef-client run, the issue is most likely with the private key.

If the authentication is happening on the node, there are a number of common causes:

The client.pem file is incorrect. This can be fixed by deleting the client.pem file and re-running the chef-client. When the chef-client re-runs, it will re-attempt to register with the Chef server and generate the correct key.
A node_name is different from the one used during the initial chef-client run. This can happen for a number of reasons. For example, if the client.rb file does not specify the correct node name and the host name has recently changed. This issue can be resolved by explicitly setting the node name in the client.rb file or by using the -N option for the chef-client executable.
The system clock has drifted from the actual time by more than 15 minutes. This can be fixed by syncing the clock with an Network Time Protocol (NTP) server.

Quoted from this link.

edit flag offensive delete link more

Comments

1.As mentioned before it is a GET call. 2.I am using Basic auth which is the correct way to go according to Chef docs 3.In this case we do not need any parameters .

jason764 gravatar imagejason764 ( 2015-07-29 05:34:17 -0500 )edit

I also tried making a similar GET call from a ruby recipe but still get the same

error:401 {"error":["Failed to authenticate as 'stevedanno'. Ensure that your node_name and client key are correct."]}

sorry Im unable to add attachments.

jason764 gravatar imagejason764 ( 2015-07-30 02:45:12 -0500 )edit

Also see this link

Syed Awais Ali gravatar imageSyed Awais Ali ( 2015-07-30 06:22:31 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower

Stats

Asked: 2015-07-23 02:15:19 -0500

Seen: 1,026 times

Last updated: Jul 30 '15