Community Tip - Have a PTC product question you need answered fast? Chances are someone has asked it before. Learn about the community search. X
Hi everyone!
I'm creating a project for my client "A".
He sells devices to his clients.
This Clients want to monitoring their devices.
To do it "A" have to enable them in his webapplication.
In "A"thingworx application A's clients are users and the devices are things.
For this reason my Client "A" would Iike to create new users, that represent his client, and associate them new things, that represent devices connected to the IoT Hub to which send data.
In this scenario i need to create a mashup for "A" in which he could do this actions.
How can i create it?
Can anyone help me??
You just need to create a service that calls upon the CreateUser snippet (can be found under the Snippets tab in the service editor; type CreateUser in the search box). Here is an example using an input parameter:
var params = {
password: "password" /* STRING */,
name: Username /* STRING */,
description: "User created on mashup" /* STRING */,
tags: undefined /* TAGS */
};
// no return
Resources["EntityServices"].CreateUser(params);
You would just have to import this service into your mashup, bind the Text property of a textbox widget and the Click event of a button widget to this service, and you're all set.
Do NOT directly use CreateUser but use a Wrapped Service to invoke Create User
then give the System User permission to use CreateUser and give System User permission to do User Create
After that you also may want to do some visibility settings if this is a 'multi-tenant' environment.