rest-client gem: 401 unauthorized with token -


i using rest-client gem try , make post api.

the restclient.post helper requires 3 arguments pass headers that: .post(url, params, headers). have tried more this?

restclient.post('http://api.example.com/', {key: 'value'}, authorization: 'a2m...')

https://github.com/rest-client/rest-client/issues/339#issuecomment-71787018

i have followed advice above receive restclient::unauthorized - 401 unauthorized response.

my code:

restclient.post "http://api.example-dev.com:7000/v1/resources", {key: 'value'}, :authorization => 'yyyyyyyy' 

i have success below curl command not above restclient.post. successful curl:

curl -i -x post -d 'test[key]=1234' -h "authorization: token token=yyyyyyyyyyyyyy" \ http://api.example-dev.com:7000/v1/resources 

this should produce same request curl:

`restclient.post "http://api.example-dev.com:7000/v1/resources", {:test => {key: '1234'}}, :authorization => 'token token=yyyyyyyyyyyyyy'` 

Comments

Popular posts from this blog

css - SVG using textPath a symbol not rendering in Firefox -

Java 8 + Maven Javadoc plugin: Error fetching URL -

order - Notification for user in user account opencart -