REST API error after updating to Indigo 2022.2.0

Posted on
Sat Mar 04, 2023 2:08 pm
DaveL17 offline
User avatar
Posts: 6756
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: REST API error after updating to Indigo 2022.2.0

berkinet wrote:
In fact, only the WebSocket API section of that doc mentions "Id" The HTTP API does not include that.

I'll take a look at adding the optional "id" element to the HTTP examples. Thanks for pointing that out.

I think all the API Command Message examples include the 'id' element where appropriate.

I came here to drink milk and kick ass....and I've just finished my milk.

[My Plugins] - [My Forums]

Posted on
Sat Mar 04, 2023 2:11 pm
jay (support) offline
Site Admin
User avatar
Posts: 18220
Joined: Mar 19, 2008
Location: Austin, Texas

Re: REST API error after updating to Indigo 2022.2.0

berkinet wrote:
I was going by the document DaveL linked earlier in this thread: REST API Conversion Examples. Id is not mentioned there.


Yes, we wanted the examples in that document to be as short as possible so fast conversions would be the order of the day.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Sat Mar 04, 2023 2:14 pm
berkinet offline
User avatar
Posts: 3290
Joined: Nov 18, 2008
Location: Berkeley, CA, USA & Mougins, France

Re: REST API error after updating to Indigo 2022.2.0

DaveL17 wrote:
berkinet wrote:
In fact, only the WebSocket API section of that doc mentions "Id" The HTTP API does not include that.

I'll take a look at adding the optional "id" element to the HTTP examples. Thanks for pointing that out.

I think all the API Command Message examples include the 'id' element where appropriate.

Thanks. In fact, I’d rather not use the field at all. But, then the API logs “missing.” So, I’ll find some use for it until Matt & Jay add the ability to suppress logging altogether.

Posted on
Sat Mar 04, 2023 2:18 pm
McJohn offline
User avatar
Posts: 631
Joined: Dec 18, 2012
Location: The Netherlands

Re: REST API error after updating to Indigo 2022.2.0

Interesting stuff to read.

The only strange thing with the script below (it's one bash script), is that there is a delay of ~9 seconds when the second Indigo variable (660038) is updated.


Code: Select all
#!bin/sh

curl -X POST -H "Authorization: Bearer the very secret key" -d '{"message":"indigo.variable.updateValue","objectId":1033915322,"parameters":{"value":"blue"}}' http://127.0.0.1:8176/v2/api/command
curl -X POST -H "Authorization: Bearer the very secret key" -d '{"message":"indigo.variable.updateValue","objectId": 660038,"parameters":{"value":"start@'$TIMESTAMP$(date "+%d-%m-%H:%M:%S")'"}}' http://127.0.0.1:8176/v2/api/command




2023-03-04 21:14:43.793 Web Server API v2 command received, id: '- no message id -' from '127.0.0.1'
2023-03-04 21:14:52.251 Web Server API v2 command received, id: '- no message id -' from '127.0.0.1'

Posted on
Sat Mar 04, 2023 2:31 pm
berkinet offline
User avatar
Posts: 3290
Joined: Nov 18, 2008
Location: Berkeley, CA, USA & Mougins, France

Re: REST API error after updating to Indigo 2022.2.0

McJohn wrote:
…it's one bash script
Code: Select all
#!bin/sh

curl -X POST -H "Authorization: Bearer the very secret key" -d '{"message":"indigo.variable.updateValue","objectId":1033915322,"parameters":{"value":"blue"}}' http://127.0.0.1:8176/v2/api/command
curl -X POST -H "Authorization: Bearer the very secret key" -d '{"message":"indigo.variable.updateValue","objectId": 660038,"parameters":{"value":"start@'$TIMESTAMP$(date "+%d-%m-%H:%M:%S")'"}}' http://127.0.0.1:8176/v2/api/command
'
I am sure this has nothing to do with the apparent processing delay you are seeing… But, just FYI, your script is running in the Bourne shell rather than bash.
The shell, or other interpreter, used to execute the script is set the the first line — known as the “shebang.” So, while you may run it from the bash shell running in a terminal window, it is actually executed by /bin/sh and will follow the scripting commands and syntax of that shell.

If you’d rather run in bash, just change the shebang to #!/bin/bash

Posted on
Sat Mar 04, 2023 2:39 pm
jay (support) offline
Site Admin
User avatar
Posts: 18220
Joined: Mar 19, 2008
Location: Austin, Texas

Re: REST API error after updating to Indigo 2022.2.0

McJohn wrote:
The only strange thing with the script below (it's one bash script), is that there is a delay of ~9 seconds when the second Indigo variable (660038) is updated.


I just ran your exact commands one after another (with my specifics of course) and they both happened within milliseconds:

Code: Select all
2023-03-04 14:37:04.786   Web Server   API v2 command received, id: '- no message id -' from '127.0.0.1'
2023-03-04 14:37:04.908   Web Server   API v2 command received, id: '- no message id -' from '127.0.0.1'


This, combined with your other issue with control pages loading slowly, seem to indicate that you may be experiencing systemic and/or network issues with your Indigo Mac.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Sat Mar 04, 2023 2:56 pm
McJohn offline
User avatar
Posts: 631
Joined: Dec 18, 2012
Location: The Netherlands

Re: REST API error after updating to Indigo 2022.2.0

Thanks for the hint Jay.

Think I just found a GUI bug?

Because a couple of hours ago these slow-problems starts when I select in the "Start Local Server window" the option: "Also allow HTTP Basic authentication" because it was spontaneous disabled when the Reflector option was enabled. So, I selected that HTTP option but selected then "Cancel".
When I later looked back into this "Start Local Server" window. I saw that the "allow HTTP Basic etc. option was still selected but I didn't Restarted the Indigo Server.
I just restart the Server and it's a lot faster now (and also remote).
But when I deselect again "allow HTTP Basic auth. etc." and select "cancel" and then opened again that window that HTTP option is still deselected..

Posted on
Sat Mar 04, 2023 3:12 pm
matt (support) offline
Site Admin
User avatar
Posts: 21417
Joined: Jan 27, 2003
Location: Texas

Re: REST API error after updating to Indigo 2022.2.0

Let's re-route the slowness discussion over onto this thread so we aren't splitting it across two topics.

Image

Posted on
Sun Mar 05, 2023 2:16 am
McJohn offline
User avatar
Posts: 631
Joined: Dec 18, 2012
Location: The Netherlands

Re: REST API error after updating to Indigo 2022.2.0

berkinet wrote:

If you’d rather run in bash, just change the shebang to #!/bin/bash


Thank you very much for your time and the script course!
Have changed the script into #!/bin/bash. Saw no difference.
After a restart of the M1 Mac mini it's running faster now.

Happy that this is working again but I still miss the good old Rest Api solution.
Never mind, we have to go on.

Up to to the next challenge: slooow control pages after the update to Indigo 2022.2

Posted on
Sun Mar 05, 2023 2:35 am
berkinet offline
User avatar
Posts: 3290
Joined: Nov 18, 2008
Location: Berkeley, CA, USA & Mougins, France

Re: REST API error after updating to Indigo 2022.2.0

McJohn wrote:
...Have changed the script into #!/bin/bash. Saw no difference....
The main differences between the different shells (like: sh, csh, tcsh, bash, zsh, etc.) is in the programming instruction set. Some, like zsh offer advanced features like arrays, math, functions, etc. For simple command line executions they are all pretty much the same. If you are interested, this page seems to offer a good introduction and overview.

Posted on
Sun Mar 05, 2023 5:14 am
McJohn offline
User avatar
Posts: 631
Joined: Dec 18, 2012
Location: The Netherlands

Re: REST API error after updating to Indigo 2022.2.0

Thanks for the feedback, interesting to read.

Au revoir!

Posted on
Thu Apr 13, 2023 10:49 am
webdeck offline
Posts: 436
Joined: May 07, 2005

Re: REST API error after updating to Indigo 2022.2.0

I got this error this morning for an API call. Does this mean that API auth tokens rely on the server being able to communicate with the internet? Was the API server having issues earlier today?

I would love to not have this dependency on the internet connection. I love using Indigo because it is local and not a cloud-based service (aside from the reflector.) It would be more robust to have the Indigo server validate auth tokens locally.

Code: Select all
   Web Server Error                Attempt to validate token failed
Traceback (most recent call last):
  File "/Library/Application Support/Perceptive Automation/Indigo 2022.2/IndigoPluginHost3.app/Contents/Resources/PlugIns/urllib3/connectionpool.py", line 386, in _make_request
    self._validate_conn(conn)
  File "/Library/Application Support/Perceptive Automation/Indigo 2022.2/IndigoPluginHost3.app/Contents/Resources/PlugIns/urllib3/connectionpool.py", line 1040, in _validate_conn
    conn.connect()
  File "/Library/Application Support/Perceptive Automation/Indigo 2022.2/IndigoPluginHost3.app/Contents/Resources/PlugIns/urllib3/connection.py", line 416, in connect
    self.sock = ssl_wrap_socket(
  File "/Library/Application Support/Perceptive Automation/Indigo 2022.2/IndigoPluginHost3.app/Contents/Resources/PlugIns/urllib3/util/ssl_.py", line 449, in ssl_wrap_socket
    ssl_sock = _ssl_wrap_socket_impl(
  File "/Library/Application Support/Perceptive Automation/Indigo 2022.2/IndigoPluginHost3.app/Contents/Resources/PlugIns/urllib3/util/ssl_.py", line 493, in _ssl_wrap_socket_impl
    return ssl_context.wrap_socket(sock, server_hostname=server_hostname)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/ssl.py", line 512, in wrap_socket
    return self.sslsocket_class._create(
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/ssl.py", line 1070, in _create
    self.do_handshake()
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/ssl.py", line 1341, in do_handshake
    self._sslobj.do_handshake()
TimeoutError: [Errno 60] Operation timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Library/Application Support/Perceptive Automation/Indigo 2022.2/IndigoPluginHost3.app/Contents/Resources/PlugIns/requests/adapters.py", line 440, in send
    resp = conn.urlopen(
  File "/Library/Application Support/Perceptive Automation/Indigo 2022.2/IndigoPluginHost3.app/Contents/Resources/PlugIns/urllib3/connectionpool.py", line 785, in urlopen
    retries = retries.increment(
  File "/Library/Application Support/Perceptive Automation/Indigo 2022.2/IndigoPluginHost3.app/Contents/Resources/PlugIns/urllib3/util/retry.py", line 550, in increment
    raise six.reraise(type(error), error, _stacktrace)
  File "/Library/Application Support/Perceptive Automation/Indigo 2022.2/IndigoPluginHost3.app/Contents/Resources/PlugIns/urllib3/packages/six.py", line 770, in reraise
    raise value
  File "/Library/Application Support/Perceptive Automation/Indigo 2022.2/IndigoPluginHost3.app/Contents/Resources/PlugIns/urllib3/connectionpool.py", line 703, in urlopen
    httplib_response = self._make_request(
  File "/Library/Application Support/Perceptive Automation/Indigo 2022.2/IndigoPluginHost3.app/Contents/Resources/PlugIns/urllib3/connectionpool.py", line 389, in _make_request
    self._raise_timeout(err=e, url=url, timeout_value=conn.timeout)
  File "/Library/Application Support/Perceptive Automation/Indigo 2022.2/IndigoPluginHost3.app/Contents/Resources/PlugIns/urllib3/connectionpool.py", line 340, in _raise_timeout
    raise ReadTimeoutError(
urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='api.indigodomo.com', port=443): Read timed out. (read timeout=None)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "plugin.py", line 199, in verify_token
  File "/Library/Application Support/Perceptive Automation/Indigo 2022.2/IndigoPluginHost3.app/Contents/Resources/PlugIns/requests/api.py", line 75, in get
    return request('get', url, params=params, **kwargs)
  File "/Library/Application Support/Perceptive Automation/Indigo 2022.2/IndigoPluginHost3.app/Contents/Resources/PlugIns/requests/api.py", line 61, in request
    return session.request(method=method, url=url, **kwargs)
  File "/Library/Application Support/Perceptive Automation/Indigo 2022.2/IndigoPluginHost3.app/Contents/Resources/PlugIns/requests/sessions.py", line 529, in request
    resp = self.send(prep, **send_kwargs)
  File "/Library/Application Support/Perceptive Automation/Indigo 2022.2/IndigoPluginHost3.app/Contents/Resources/PlugIns/requests/sessions.py", line 645, in send
    r = adapter.send(request, **kwargs)
  File "/Library/Application Support/Perceptive Automation/Indigo 2022.2/IndigoPluginHost3.app/Contents/Resources/PlugIns/requests/adapters.py", line 532, in send
    raise ReadTimeout(e, request=request)
requests.exceptions.ReadTimeout: HTTPSConnectionPool(host='api.indigodomo.com', port=443): Read timed out. (read timeout=None)

Posted on
Thu Apr 13, 2023 11:36 am
matt (support) offline
Site Admin
User avatar
Posts: 21417
Joined: Jan 27, 2003
Location: Texas

Re: REST API error after updating to Indigo 2022.2.0

Because the UI to create/delete API tokens is currently on our server, the Indigo web server (on your Mac) does have to occasionally validate API keys. If you are using the most recent version of Indigo (released about a week ago), then that validation is cached on your Indigo Mac for about a day so the number of calls needed to our server should be minimal (but do exist).

Is it working now for you? If it never works, then your IP address might have been blocked by our firewall or something.

Image

Posted on
Thu Apr 13, 2023 11:39 am
webdeck offline
Posts: 436
Joined: May 07, 2005

Re: REST API error after updating to Indigo 2022.2.0

matt (support) wrote:
Because the UI to create/delete API tokens is currently on our server, the Indigo web server (on your Mac) does have to occasionally validate API keys. If you are using the most recent version of Indigo (released about a week ago), then that validation is cached on your Indigo Mac for about a day so the number of calls needed to our server should be minimal (but do exist).


Thanks. I need to update to the latest release. Would it make sense to continue to use an expired cached version if the auth server can't be reached?

Posted on
Thu Apr 13, 2023 11:43 am
matt (support) offline
Site Admin
User avatar
Posts: 21417
Joined: Jan 27, 2003
Location: Texas

Re: REST API error after updating to Indigo 2022.2.0

Possibly. We'll file this as an issue and look into it (or other similar solutions).

Image

Who is online

Users browsing this forum: No registered users and 12 guests