Skip to content
OAOpenAppPhysical Security as a Service
Login

10. The same call from the SDK

Install the SDK for your language (use the language selector on this page). Your API key string embeds the API base URL, so connecting usually needs only the key—see SDK authentication.

from openapp_sdk import Client
ENTITY_ID = "paste-your-entity-id-here"
API_KEY = "paste-your-full-api-key-here"
def main() -> None:
client = Client.connect(api_key=API_KEY)
result = client.entities.actions(
entity_id=ENTITY_ID,
action_id="switchable.open",
body={},
)
print(result)
if __name__ == "__main__":
main()

For async clients, follow the same patterns as in the SDK overview.

client.entities.actions is the usual pattern for one OpenApp call from application code.

Open the door with OpenApp Scripting (client.scripting)

Section titled “Open the door with OpenApp Scripting (client.scripting)”

For several operations in one program—or the same action packaged as a .openapp file on disk—use the client.scripting sub-client. The following two styles are equivalent; both call entity_action on the door entity (the same effect as switchable.open above).

1. Pass scripting source as a string to execute:

result = client.scripting.execute(
script=f'entity_action("{ENTITY_ID}", "switchable.open", #{{}});'
)
print(result)

2. Pass a .openapp file path to execute_file (the SDK reads the file and posts its contents to POST /scripting/execute):

Create open-door.openapp next to your script:

entity_action("paste-your-entity-id-here", "switchable.open", #{});
result = client.scripting.execute_file("open-door.openapp")
print(result)

OpenApp Scripting in the next step walks through the same open-door program with a bit more context; Scripting reference covers the full language.


← HTTP API · Try the same action with OpenApp Scripting →