How can I add multiple users to a GoodData project through a rest client - json

I am currently using the following syntax to add an individual to a project through a rest client.
{ "user" : {
"content" : {
"status":"ENABLED",
"userRoles":["/gdc/projects/n32w1hmt4if84vrcinsunvo4bo72cj38/roles/4"]
},
"links" : {
"self":"/gdc/account/profile/3c793eb92ca1dcbd8254d9b02cb49ac8"
}
}
}
I would like to be able to add an entire list of people to a project at one time. Is this possible?

Actually it's unsupported by the API itself. You have to call the API in a loop for every single user you want to add into the project. The solution is to write your own code to do that.
You can also use our Ruby SDK where you can easily use GoodData methods, we already have projectInvitation method implemented.
See this for more details:
http://sdk.gooddata.com/
Please let me know if you have any questions!
Jan

Related

converting dynamic content to JSON

I'm building a pipeline who sends a secret to the rest API of Azure key-vault with the Azure data factory tool (https://learn.microsoft.com/en-us/rest/api/keyvault/secrets/set-secret/set-secret). If I set the secret hardcoded then it works fine but if I replace it with my dynamic content variable it gives a newline error. Does anyone has a solution for this problem?
click here for an image of the error
The working code:
{
"values": "test"
}
the not working code:
{
"values": #variables('push_refresh_token')
}
Thank you #AnnuKumari-MSFT & #KoenVerschuren-6858 Posting your solutions as answer in community wiki to beneficial other community members for the similar issue.
Here is the workaround from MS Q&A:-
We need to add quotes to the variable with concatenate:- For
example:-
To set variable:
#concat('"', string(activity('get_auth_code').output.refresh_token),'"')
which is followed by in web;
#concat('{"value":', variables('push_refresh_token'),'}')

Jelastic manifest prepopulation of list values

I am creating a deploy for OpenMage e-commerce here: https://github.com/ProxiBlue/openmage-cluster
In the creation settings dialog, I want to prepopulate the TIMEZONE, LOCALES and CURRENCY from a list generated by a PHP script.
Relevant parts are here:
Generated prepopulate data: https://github.com/ProxiBlue/openmage-cluster/blob/main/settings/populate.txt
Script I use to make that: https://github.com/ProxiBlue/openmage-cluster/blob/main/scripts/settings_generate.php
and then the manifest: https://github.com/ProxiBlue/openmage-cluster/blob/main/manifest.jps#L31
I pinged Jelastic support and they gave me this format to use to make the prepopulate:
{ "result": 0, "data": { "yourSettingName1": "value1", "yourSettingName2": "value2" } }
however, that only seems to allow population of single value fields, so I end up with OBJECTS in the list selection:
There must obviously be a different format for this, but their docs don;t show what it should be.
Anyone can help me out here?
There must obviously be a different format for this, but their docs don't show what it should be.
Option "prepopulate" in JPS manifests can be used only to fill simple "Key:Value" pairs, and does not support a list of values.
Instead, for enabling more dynamic changes in prepopulated values, we suggest you use onBeforeInit event.
Example of OpenMage Cluster manifest with it you can find in the link below:
https://gist.github.com/SlavaKatiukha/6babcefcae557813fe11f994bc13599d#file-openmage-cluster-settings-example-yaml-L61-L69

Twilio Autopilot, best method to check mobile number in external database

I would like to use Twilio autopilot to build a whatsapp Chatbot. I need to know if a user has already used our service before. This means that on initiation, i get the data from an external source, i can then use functions to further specify the chatbot logic.
I am wondering what are the best options in the twilio environment to get that external data loaded in event or memory? I see webhooks are only for diagnostics, and i dont know what are the async capabilities of functions. Could someone elaborate a bit about the pro's and cons of different methods?
Thanks
you can take a look at The Autopilot Request. These request parameters are provided to your application (via a webhook associated with a task), where you can add additional logic to see if this is a new user or returning user and return the appropriate Autopilot Actions, one of which is Remember.
An approach would be setting a webhook that will determine if the User has used the system before on to the Assistant's assistant_initiation more info
The webhook can then reply with a JSON Remember + Redirect
Example -
{
"actions": [
{
"remember": {
"isNewuser": "true"
}
},
{
"redirect": "task://newUserTask"
}
]
}
OR
{
"actions": [
{
"remember": {
"isNewuser": "false"
}
},
{
"redirect": "task://oldUserTask"
}
]
}
Also since "isNewuser": "true" will be on the assistant's memory you can use that info on any following task until the session (4 Hours) expires.

piwik widgets & java api

I'm currently using piwik's java api to get my stats but I have some dificulties.
To begin, my standard code :
try {
SimplePiwikTracker piwik = new SimplePiwikTracker(3, myServer, request);
piwik.setPageCustomVariable(ACCOUNT_NUMBER, clientAccountNumber);
piwik.sendRequest(piwik.getLinkTrackURL(request.getRequestURL().toString()));
} catch (PiwikException e1) {
logger.error("Piwik error", e1);
}
The first problem is that even if I can see visited pages in "user logs", the widget "pages" does not display it.
The second, I want to know the number of different users that are using my website. To do so I send a custom variable containing the client's account number. Do you know a way to know how many different account numbers I have in my stats ?
Thank you for your help and sorry if there's any english mistakes (I hope there is not). :)
I found an answer for my first question.
Instead of using :
piwik.sendRequest(piwik.getLinkTrackURL(request.getRequestURL().toString()));
The solution is to use :
piwik.sendRequest(piwik.getPageTrackURL(request.getRequestURL().toString()));
A possible answer to the second question :
When you create a custom variable that is sent to your piwik server go to the custom variable widget. The pagination displayed when you select a variable can be an indication.
But if someone have a better answer, I'd be glad :)

How to archive Jira version with REST API

I'm trying to automatically archived versions in Jira.
So far, I've been able to create and update versions in Jira with the REST API, but no luck with archiving a version.
I've try just setting the field archived from false to true using something like this:
{ "update" : { "archived" : [{ "set" : true }] } }
I've also try to set the released field at the same time.
I did also try to send all version's fields with archived updated.
All without success, so I'm guessing there is something else that needs to be done in that case.
So to resume this, I am mainly trying to find the exact json content to archive a version since I already know how to use JIRA REST API.
Thanks.
As described in the API docs, versions don't use an "update" field for updating. Simply PUT the data {"archived": true} to http://JIRA-SERVER/rest/api/2/version/VERSION-ID.