Computer Related > Using REST APIs Miscellaneous
Thread Author: smokie Replies: 13

 Using REST APIs - Kevin
>But how do I input the example he has? This one.

You don't have an http server listening on localhost so the connection is being refused. I wouldn't worry about it, I'd just get http connecting to octopus and retrieving the data you want.

The second line onwards in the example command is indeed the response from the server and you should see the "200 OK" in all responses from octopus unless there is an error. You can check for the "200 OK" in your perl script to make sure that the response is valid.

>But more to the point I'm assuming I am now at the point where I'm going to start doing a PERL script, to make
>the connection to Octopus then pass the parameters - is that so?

No. I would save the response from a valid http command into a local file and work with that to get perl parsing and outputing exactly what you want. Once you're happy with that you can just add the http command to your perl script and use live data. There's no point in querying octopus every time while you try to debug the parsing and formatting in your script. Also, be careful of being too specific/literal with your pattern matching in the script, for example the "HTTP/1.1" in the "200 OK" response could change and break your script if the server admins upgrade or make changes to the server.

After the script is working with a fixed http command and you are comfortable with perl you can add more functionality as needed.
 Messages Author Date
 Using REST APIs new smokie 10 Jan 19 08:57
 Using REST APIs new Kevin 10 Jan 19 20:32
 Using REST APIs new smokie 11 Jan 19 09:16
 Using REST APIs new Kevin 11 Jan 19 23:27
 Using REST APIs new smokie 12 Jan 19 00:32
 Using REST APIs new smokie 12 Jan 19 09:03
 Using REST APIs new Kevin 12 Jan 19 22:34
 Using REST APIs new smokie 13 Jan 19 18:57
 Using REST APIs new Kevin 13 Jan 19 20:51
 Using REST APIs new Kevin 18 Jan 19 23:21
 Using REST APIs new smokie 19 Jan 19 08:11
 Using REST APIs new Kevin 19 Jan 19 23:11
 Using REST APIs new smokie 19 Jan 19 23:46
 Using REST APIs new smokie 8 Feb 19 08:15
Latest Forum Posts