API not authenticating usng RESTClient on VS2015 #9384
deivishome
started this conversation in
General
Replies: 2 comments 2 replies
-
Also tryed with: |
Beta Was this translation helpful? Give feedback.
0 replies
-
I get it work!!! it was a problem of the URL: It must be So if any other people are facing the same isue, have a look into your request URL, IT MUST NOT END WITH ( / ) Best regards. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi everybody,
my name is David, i am trying to communicate using RESTClient with the API, using Postman everything works fine, but from VS2015 or even VS2019 it does not work.
I have checked headers, also as i read in other posts about apache directives, mines are:
DocumentRoot /var/www/snipe-it/public
ServerName xxx.xxxxx.com
<Directory "/var/www/snipe-it/public">
AllowOverride All
Options -Indexes
DirectoryIndex index.php
SSLEngine on
SSLCertificateFile /etc/ssl/certs/xxxxx_com.crt
SSLCertificateKeyFile /etc/ssl/certs/xxxx.com.key
SSLCACertificateFile /etc/ssl/certs/xxxx_com.ca-bundle
SSLCipherSuite EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:ECDHE-RSA-AES128-SHA:DHE-RSA-AES128-GCM-SHA256:AES256+EDH:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES128-SHA256:DHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES256-GCM-SHA384:AES128-GCM-SHA256:AES256-SHA256:AES128-SHA256:AES256-SHA:AES128-SHA:DES-CBC3-SHA:HIGH:!aNULL:!eNULL:!EXPORT:!DES:!MD5:!PSK:!RC4
SSLProtocol -all +TLSv1.3 +TLSv1.2 +TLSv1.1
SSLOpenSSLConfCmd DHParameters "/etc/ssl/certsdhparam.pem"
So I don't know if something is wrong, my code to connect to the API is:
Dim client = New RestClient("https://xxx.xxxxx.com/api/v1/licenses/")
Dim request = New RestRequest(Method.GET)
request.AddHeader("Authorization", "Bearer KEY_FROM_THE_WEB_INTERFACE_OF_SUPER_ADMIN)
request.AddHeader("Content-Type", "x-www-form-urlencoded")
request.AddHeader("Accept", "application/json")
request.RequestFormat = DataFormat.Json
client.FollowRedirects = True
Dim response As IRestResponse = client.Execute(request)
From postman i get all the information but from VS all the time I get Unauthorized
Thank you very much for your help.
Best regards,
Beta Was this translation helpful? Give feedback.
All reactions