URLConnection

i mean this

TheWebConnection.RequestHeader(“accept”) = “text/plain”

it looks equal

-H  "accept: text/plain" -H  "login: user" -H  "password: pass"

in your method/event where you do the reques
mySock.ClearRequestHeaders()
mySock.RequestHeader(“login”) = login
mySock.RequestHeader(“password”) = myPass
mySock.RequestHeader(“Accept”) = “text/plain”
mySock.SetRequestContent("", “application/x-www-form-urlencoded”)
mySock.Send(“POST”, THE_URL)

The data will be in the mySock.PageReceived event… or error if any.
Make sure you check if the “” vales are clean of strange ascii characters. in the IDE select the strings and right-click clean ASCII … you’ll see a round dot if there where bad values, clear those and you’r good.

the curl send no data -d “”

i think its sending the login in http header and not as form data.

see the SetRequestContent is empty ? just as curl does.
curl sets POST so it’s “application/x-www-form-urlencoded”

1 Like

hmm empty string encoded :slight_smile: ok

can @Frédéric_QUOIREZ send some documentation link?

i can’t do french …

ok i translated it, you should get a response with a “Cookie” header that has a “JSESSIONID” cookie in it if the response was successful.

there is nothing in the documentation saying about http status codes, which means this could simply be any status code… You should check the ResponseHeaders if they contain a “Cookie”. check the value of it for “JSESSIONID”

Yes, thanks, but for now I get a 400 error

400 Bad Request

Bad Request

Your browser sent a request that this server could not understand.

did you check the response headers?
Their docs say “nothing” about status codes, could even be 400 with a response…

in my browser i get a cookie with a JSESSIONID. if you are logged in, check the request and response in a browser and use the developer tools or right-click then inspect element - > network.

As above people mention, it’s an easy way to get to know the request and response values/headers

Here is what I get in the headers with 400 error

Date : Tue, 28 Jul 2020 15:10:50 GMT
Content-Type : text/html; charset=iso-8859-1
Connection : close
Content-Length : 226

No JSESSIONID… Quite sure I 'm supposed to have a HTTP 200 answer

And I do get the cookie in my browser.
But nothing good with Xojo…
It’s driving me mad !

Well try to contact them may be an option?

They don’t provide help, it’s written on the site…

i made a test with urlconnection but i have no account and it seems it is not free for all + its in france.
can you send me the login & password mail or message mentioned here as pm for a test?

Login du compte utilisateur (tel que transmis lors de la création de votre compte)

the point where i can’t continue without login. the same issue you have.

https://opendata-rncs.inpi.fr/services/diffusion/login
422
{
“globalErrors”: [
“Le login et le mot de passe saisis ne correspondent pas.”
]
}

I will, Markus, but there is a problem with my acoount.

I’ ll test again when it’ will be solved.

Thannks again All !

I can confirm that this code is correct and produces the expected result given an incorrect username/password combination.

Connection.RequestHeader("login") = "UserName"
Connection.RequestHeader("password") = "Pass"
Connection.SetRequestContent("", "application/x-www-form-urlencoded")
Connection.Send("POST", "https://opendata-rncs.inpi.fr/services/diffusion/login")

Status Code 422

{
  "globalErrors": [
    "Le login et le mot de passe saisis ne correspondent pas."
  ]
}

It’s almost like you entered the username and password incorrectly…