REST Endpoint and dynamicPage

Hey all,

Has anyone had any luck adding a dynamic page to the preferences of a REST Endpoint app? I’m trying to add selective access to Hello, Home phrases similarly to the method used here: Can someone modify the big switch app to call Hello Home Phrases? it works inside the IDE but when I hit the endpoint with my browser, the page stops right after the drop down for selecting a location.

Any clues?

Not sure what this means. Can you give us more details? The endpoint should not have a “dropdown” once the page is loaded then the endpoint action is taken. Please give a step hu step of what you did.

Are you asking about the transition from page to page in the app setup?

Hey Tim,

Here’s a screenshot:

The drop down I mention is the one that says “home” and the single bullet point below is where the list of devices (switches, locks and phrases in this case) should be.

Here’s the relevant code:

name: "REST Endpoint test",
namespace: "",
author: "Eran Globen",
description: "test dynamically loading Hello, Home phrases for REST app.",
category: "My Apps",
iconUrl: "",
iconX2Url: "",
oauth: true)

preferences {
    page(name: "selectPhrases")

// phrases

// seems to not work because can't load dynmic page during oauth config.
def selectPhrases() {
	log.debug "loadings preferences..."
    dynamicPage(name: "selectPhrases", title: "Configure", uninstall: true) {	
        section("Allow Endpoint to Control These Things...") {
            input "switches", "capability.switch", title: "Which Switches?", multiple: true
            input "locks", "capability.lock", title: "Which Locks?", multiple: true
            log.debug location

			def phrases = location?.helloHome?.getPhrases()*.label
            if (phrases) {
                log.debug phrases
                input "phrases", "enum", title: "Which phrases?", multiple: true, options: phrases

Did you hit authorize to get the links to switches?

Also, you created a virtual switch to control the app right?

I don’t want to hit authorize yet because I haven’t selected which devices to control. And I’m not sure what this has to do with a virtual switch. The app will be controlled by whatever external client sends in HTTP requests.

Looks like an email/chat with Support is the next step.

Unfortunately, this is not possible right now. However, we are getting there. In the next week or so, we’ll have support for static pages being flagged as the one OAuth page to be used to get all the preferences to use during the OAuth flow. There is also worked plan to support this specific case of having dynamic pages used for OAuth.

Sorry this doesn’t help you now, but we are working on it!

Thanks, Matt! I’ll just leave it as is for now.

Are there any updates on this issue?

I believe that I am having a similar issue when using the “Smart Alarm” app and going through the Oauth process. The “Smart Alarm” app uses dynamic pages.

Any update on this ?

@geko and @lacbra Good question. I think it got delayed but let me check on it to make sure.

This is now available. You can see it in the “Logitech Harmony Connect” SmartApp as an example. Basically it will work like this:

preferences(oauthPage: "deviceAuthorization") {
    page(name: "connect" ...
    page(name: "deviceAuthorization" ....

Where the oauthPage option is set in the preferences block.

1 Like