Wink API is currently on version 2.
My Question: How can you do a simple "Hello World" with the Wink API V2 via PHP?
Notes:
- Wink uses PubNub for subscriptions (devices have an event)
- Uses OAuth2 standard
- Website/Login is often "hokey": (& will error when you login: "Authentication failed!")
- Login here: https://developer.wink.com & use Google account (or whatever)
- Then change URL to this: https://developer.wink.com/clients
- Sometimes you have to do this a couple times!!
- You will need to request an Application API key in order to use the API. I followed up with an email to get it approved swiftly.
- Once you are approved, you'll get: Client ID, Client Secret, & URLs to assist
- API URL: https://api.wink.com/...
- Email support: [email protected] (Get Application API key, etc)
- OAuth 2:
- Wink indicates to use "Authorization Code Grant Type"
- Dox & Example: https://developer.byu.edu/docs/consume-api/use-api/choose-grant-type
Related Links:
- Wink API: https://winkapiv2.docs.apiary.io/#
- Stackoverflow related questions:
- https://community.home-assistant.io/t/wink-access-token-issue/52197/15
- Github Example: https://github.com/cbulock/php-wink (This was last updated 3 years ago; might be on previous API ver)
Information regarding this is extremely limited, so I'll answer my own question hoping to help others. (It took a long time since there wasn't any good info out there.) This example has a user interface (Login required by Wink). I'm hoping someone can post a non-user-interface version (for background scripting, etc).
This will give you raw json output, for you to do with as you wish. This single php page will initially load, take you to Wink's login (you need an account with your devices if this wasn't obvious), after logging it, it will take you back to this same page with a code, call for a token, then use that token to get the device resources.
Create: //[YourServer]/wink_helloworld.php on your http/php server.
wink_helloworld.php: