FORUMS PROFESSIONNELS
WINDEV
,
WEBDEV
et
WINDEV Mobile
Accueil
|
Messages récents
|
Connexion
|
Déconnexion
|
Français
Accueil
→
WINDEV 2024
→
HTTP request - Logging in to Quality guard
HTTP request - Logging in to Quality guard
Débuté par willy hermans, 27 nov. 2017 10:49 - 4 réponses
Connectez-vous…
willy hermans
#1
Posté le 27 novembre 2017 - 10:49
HTTP ERROR: 405
Problem accessing /v2/recipeinfo/21. Reason:
Method Not Allowed
Powered by Jetty:// 9.3.11.v20160721
Signaler
0
0
M-K
#2
Posté le 30 novembre 2017 - 12:23
Hi,
I guess your question is that you cannot retrieve information from a page and this is the error you get?
In that case you are using the wrong httpmethod ( httpget, httppost, etc)
Scroll to the method part in this doc for more information:
https://doc.windev.com/en-US/…
Signaler
0
0
willy hermans
#3
Posté le 06 décembre 2017 - 08:04
Hello,
Meanwhile, something has already evolved.
I use the following code.
sURL is string
sURL="
http://test.qguardportal.be:8443/v2/recipeinfo/21
"
sHTTPRequest is httpRequest
sHTTPRequest..ContentType="application/json"
sHTTPRequest..Header["X-API-TOKEN: 4723152"] --> This expression returns an unused value
//sHTTPRequest..header["Accept: application/json"]
sHTTPRequest..URL=sURL
sHTTPRequest..Method=httpGet
cMyResponse is httpResponse = HTTPSend(sHTTPRequest)
IF ErrorOccurred THEN
Error(ErrorInfo(errFullDetails))
ELSE
EDT_NoName1 = cMyResponse..Content
END
The result is :
{"error":"You do not have access to this resource."}
The provider of the service tells :
From the curl you get after the 'try it out':
curl -X GET - header 'Accept: application / json' - header 'X-API-TOKEN: 4723152' '
http://www.qguardportal.be:8443/v2/recipeinfo/21
'
You have to take the last url:
http://www.qguardportal.be:8443/v2/recipeinfo/21
And then you have to add 2 more headers:
Accept: application / json
X-API TOKEN: 4723152
With best regards
Eline Desmet
Analyst / PO
The given info is for test only so it is not a specific account
So I think the error is in the line
sHTTPRequest..Header["X-API-TOKEN: 4723152"]
Anyone an idea.
Thanks already
Willy Hermans
Signaler
0
0
Ned!
#4
Posté le 06 décembre 2017 - 11:06
Hi Willy,
This code should do it for you. You were nearly there...
sURL is string sURL="
http://test.qguardportal.be:8443/v2/recipeinfo/21
" sHTTPRequest is httpRequest sHTTPRequest..ContentType="application/json" sHTTPRequest..Header["X-API-TOKEN"] = "4723152" sHTTPRequest..Header["Accept"] = "application/json" sHTTPRequest..URL=sURL sHTTPRequest..Method=httpGet cMyResponse is httpResponse = HTTPSend(sHTTPRequest) IF ErrorOccurred THEN Error(ErrorInfo(errFullDetails)) ELSE EDT_NoName1 = cMyResponse..Content END
Thanks
Ned
Signaler
0
0
willy hermans
#5
Posté le 06 décembre 2017 - 14:01
Thank you very much.
This seems to werk perfectly
Willy Hermans
Signaler
0
0
→ Revenir à WINDEV 2024
WINDEV 2024
WEBDEV 2024
WINDEV Mobile 2024
WINDEV (précédentes versions)
Français
English
Español
Portuguesa
Fermer cette fenêtre
Type de recherche
Uniquement les sujets
Tous les messages
Période de recherche
Date indifférente
Moins d'une heure
Moins de 24 heures
Moins d'une semaine
Moins d'un mois
Moins d'un an
Annuler
Aperçu de votre message
Ajouter une image
Importer une image depuis une URL
Envoyer une image depuis un fichier de votre disque
Déposez ici un fichier ou cliquez sur "Parcourir..."
ou
Annuler
0%
WLangage
SQL
XML, HTML
JAVA, Javascript
Texte