Losant API block to create Application

Hi there,
I am unable to find the Application Create option in this block:

But I can see this should be possible from the documentation

Is it under a different name?

The Losant API Node can only operate in the context of an application; creating a new application falls outside of that context, thus the operation is not exposed.

If you want to create an application in a workflow (sidebar, I’m interested to hear what the use case is if you don’t mind sharing), you can use an HTTP Node and make a POST https://api.losant.com/applications request, filling out the body appropriately.

You will need to authenticate the request with a User Token. For security purposes I recommend creating a token with as limited a scope as possible (for example, only giving it permission for the Applications: Post endpoint).

Alright makes sense, yes the reason is that I have the concept of an application from a system we have developed and I have to migrate those applications into Losant, so I want to do it automatically and incrementally.
Then for each application I will also load a set of devices and that’s pretty much it.

Ouch getting some grief from the POST method.

The API token is set to all permissions, I didn’t know which ones I had to enable, but I am getting an Access is Forbidden.

Application token is set to all:

image

Okay, this is interesting, I was in the wrong panel, so when I go into the User panel I created an API token. I can see how my applications created in the Sandbox, which I can then later import in my Organization but the problem is that I am unable more than 5 devices because of the limitations.
Hmmmmm

“I was in the wrong panel” - meaning you had created an application-scoped token instead of a user-scoped token? I know you marked this as resolved but I just want to confirm where things went wrong so we can make the documentation a little more clear if necessary.

Hi that is correct, it would be helpful if:

  • creation of the application can be directly scoped into an Org not the Sandbox (otherwise I get the device limitations)
  • an API to also automatically transfer Application from Sandbox to an Org

Question: will the application ID change when I transfer from the sandbox to an org?

So a user token is not really “sandbox-scoped”; rather, it’s scoped to anything your user account has access to, which includes any organizations you are a member of. And assuming you are an editor or administrator in the organization, you would be able to use that token to create an application in that org.

Check out the schema for creating an application; you can pass an orgId in the request, and that will serve as the owner of the new application.

FYI, the Losant user interface also uses the same public API that we expose to everybody else, so if you see it is possible to take a particular action in the web portal, it’s a safe bet that it is also possible to do the same action in the API.

To answer your other two questions: