Need API Help!

(Craig) #1

I’m a rookie when it comes to writing API commands. My goal is to improve an app that uses a forscam’s motion detector. In that effort I have to figure out just how the APIs work. I’m hoping to get help here on this super simple program and get it up and running.

    name: "Test API.",
    namespace: "Home",
    author: "Craig via SmartThings",
    description: "can't get APIs to work...",
    category: "My Apps",
    iconUrl: "",
    iconX2Url: ""

preferences {
	section("Take a burst of pictures") {
		input "camera", "capability.imageCapture"
		input "burst", "number", title: "How many? (default 5)", defaultValue:5, required: true

def installed() {
	log.debug "Installed with settings: ${settings}"

def updated() {
	log.debug "Updated with settings: ${settings}"

mappings {

	path("/camera") {
		action: [
			GET: "getCamera"

def getCamera() { "it worked"

I went through the basic steps on this page: ST API Documentation. I ended up with this URL:

First Problem: I’m getting this error:

{“error”:true,“type”:“AccessDenied”,“message”:“You are not authorized to perform the requested operation.”}

(Eric R) #2

I think you need …ON?**access_token=**OATH_KEY

(Craig) #3

@baldeagle072 - Thank you. Now I’m getting this error:

{“error”:true,“type”:“AccessDenied”,“message”:“This request is not authorized by the specified access token”}

I’ve gone through the steps to get a new OATH key several times all with the same error.

(Craig) #4

Nice!! I figured it out. Apparently the ID in the “edit” URL is not the APP ID but the id in the logs is!

(Craig) #5

Ok new problem. FOSCAM URL can’t be over 121 characters (I know random!). STs URL is very long because of all it’s Key’s. I’ve stripped everything down I could and I’m still at 123 characters. Anyone have any ideas?

(Eric R) #6

You could use an URL shortener. Not sure how secure that would be