Reputation: 1232
I have a working curl command which returns exactly what I want, bunch of JSON:
curl -D- -u username:password -X GET -H "Content-Type: application/json" https://stash.address.net/rest/api/1.0/projects/FOOBAR/repos\?limit\=1000
And I need to transform it into RestClient::Request, but I am still getting 401 back:
RestClient::Request.execute(
method: :get,
headers: {
content_type: 'application/json'
},
username: 'username',
password: 'password',
url: 'https://stash.address.net/rest/api/1.0/projects/FOOBAR/repos',
params: {
limit: '1000'
},
verify_ssl: false
)
Did I forget something? Is there something missing from my request? Isn't it exactly same as the curl command above?
Upvotes: 0
Views: 384
Reputation: 176412
From the documentation I don't see any mention of the username
and params
options. They suggest to interpolate the value in the URL.
RestClient.get 'https://username:[email protected]/rest/api/1.0/projects/FOOBAR/repos', { accept: :json, params: { limit: 1000 }}
Upvotes: 1