HTTP Post request - Page 2 - Forum

Forum Navigation
You need to log in to create posts and topics.

HTTP Post request

PreviousPage 2 of 2

Thanks in advance for the support,

below is the python script

import time
from turtle import delay
import requests


url = '192.168.1.100:8100/work/123456'

call_system = { "pass": "123456789",
    "@START":"user1",
    "@END":"user2"
}

x = requests.post(url, json = call_system)

 
print(x.text)

when I run this script in python the server replies me, as below:

{"𝑖𝑑": 100000010000010017, "𝑠𝑡𝑎𝑡𝑢𝑠": "𝑠𝑢𝑐𝑐𝑒𝑠𝑠"}

 

About the subroutine you pointed out to me, is it correct as I wrote?See Attachment

 

PS: Next week I can try the new VisualNeoWeb script with the new subroutine and I will update you

 

Uploaded files:
  • You need to login to have access to uploads.

@nikyred

About the Python script ...

- can you tell how you invoke it ? ... from your Browser's Address Box ?
- I will try and investigate if there is something in the imports that is missing when you use neoAjaxSend

About the subroutine you pointed out to me, is it correct as I wrote?See Attachment

Yes, but for added investigative facility, I would add a jsAlert command before the parseJSON command (the error subroutine already has one of these commands).

If neither of the jsAlert commands are popped up at run time (meaning there was no return from the router), you will need to 'Inspect' the browser for clues about why the request was blocked.

@gaev

- can you tell how you invoke it ? ... from your Browser's Address Box ?

I call it directly in the Visual studio Code environment

 

Thanks

 

@nikyred your NeoScript code should work exactly the same as the Python script:

CreateEmptyObject [mydata]
SetVar [mydata('pass')] "123456789"
SetVar [mydata('@START')] "user1"
SetVar [mydata('@END')] "user2"
neoAjaxSend "http://192.168.1.100:8100/work/123456" "POST" "[mydata]" "json" "parseData2" "error"

The parseData2 subroutine:

ConsoleLog [data]
ParseJSON "[data]" [resultObject]
SetVar "[returnedID]" "[resultObject.id]"
SetObjectHTML "Container1" "[returnedID]"

This could be the error subroutine:

jsAlert "There has been an error"

Also be sure there is not any CORS blocking problem.

Regards

Hi, back to this topic.

how can i insert an SSL certificate? when I make the request it tells me that I need the SSL certificate.
Do I have the certificate and have it entered?

I have installed the certificate in "Manage user certificates" of windows 10, is it correct?
or should I insert it in Visual neo WEB?

@nikyred SSL certificate is for your server. It should be installed by your hosting provider usualy for free. It allows your script to be served under a secure "https" protocol instead of just "http" so the information sent between your web browser and the server is encrypted.

Regards.

Ok thanks for the reply.

The request is not to an Internet web server but to a machine web server.
I have 2 certificates, one to insert in the machine and the other in my PC.

my doubt was if I had to specify to Visual Neo web where the certificate was.

my doubt was if I had to specify to Visual Neo web where the certificate was

No. it's just for the connection between the app running into the web browser and the web server.
As far as I know, the certificate must be installed to be used by your web server.

nikyred has reacted to this post.
nikyred

Sorry if I come back to this topic again.

I managed to make the call through the neoAjaxSendEx method and not with the neoAjaxSend method.

Now the problem is with the return information from the server.
Returns a problem on the object.

The information returned from the server is as follows:

{
    "status": "success",
    "id": 1111111111111111111111
}

 

The subroutine used is in the attached image.

Is the error in the subroutine used?
How can I solve?

Thanks

 

 

Uploaded files:
  • You need to login to have access to uploads.

@nikyred you must parse the JSON data you are receiving from the server. Please check this thread:

https://visualneo.com/forum/topic/help-with-json-neophp-login-result

Regards.

 

Hi,

The Json that comes back to me from the server is as follows.
I tried to follow the guide and the advice of the forum but I could not.

How could I manage the subroutine?

Thanks

 

 

This below is the return server json

{
    "status": "success",
    "id": 123456789
}

 

@nikyred please include a complete sample app so we can take a look.
It's easier that it seems.

Regards.

Hi Luishp,

I want to remember that the request is made successfully, but it returns me the error on the response.
I probably got the subroutine wrong.

Thanks for collaboration

Below the file app.

 

Uploaded files:
  • You need to login to have access to uploads.

Hi Luishp,

Have you tried checking the schedule?

Thanks a lot for your support

@nikyred I can't test your app. You are doing a local call I can't do.
I have modified your sample to call the WordPress API of this site. Please check the attached file.
Regards.

Uploaded files:
  • You need to login to have access to uploads.

HI
I wanted to ask You if with Visual Neo There is a function to bypass the certificate check.

Thanks

@nikyred not sure what you are asking for but probably not.

Regards.

Hi,

in python through the verify_False statement

response = requests.post(url, headers=headers, json=data, verify=False)

 

I don't check the certificate, It can't be done even in Visual Neo Web through the Ajax call

@nikyred that's because web apps have additional security measures. They are forced by the web browser.

Thanks,

Now is clear

PreviousPage 2 of 2