onlineMeetingUrl is coming null and onlineMeetingProvider is 'unknown' while creating event for a user by using graph api, Why? - microsoft-graph-api

I am using graph api to create events for almost 50 users and for all users when i am creating event with
isOnlineMeeting: true and onlineMeetingProvider: 'teamsForBusiness' keys in request body events are creating successfully and returning the response
endpoint I am calling is
axios.post(`https://graph.microsoft.com/v1.0/users/${userId}/calendar/events`,requestBody,options)
request body
requestBody = {
subject:MeetSubject,
start:{
dateTime:isoStart,
timezone:'UTC'
},
end:{
dateTime:isoEnd,
timezone:'UTC'
},
recurrence: recurrenceData,
attendees: [
{
emailAddress: {
address: attendeEmail,
name: attendeName,
},
type: 'required',
},
],
isOnlineMeeting: true,
onlineMeetingProvider: 'teamsForBusiness'
};
response
{
....
....
onlineMeetingProvider: 'teamsForBusiness',
onlineMeeting: {
joinUrl: 'https://teams.microsoft.com/l...../.
}
}
}
But for a perticular user when I am creating the event with simillar request body so event is created successfully but in the response event Object i am getting
response
{
....
....
onlineMeetingProvider: 'unknown',
onlineMeeting: null
}
why it is like that
is there something which i am missing for that perticular i don't know what
and app has those permissions already
TeamSettings.Read.All
TeamSettings.ReasWrite.All
OnlineMeetings.Read
OnlineMeetings.ReadWrite

Related

How edit asset name?

How i can edit asset name? its doesnt work. Thanks
let assetService = $injector.get(self.ctx.servicesMap.get('assetService'));
let activeID = self.ctx.data[0].datasource.entityId
let tenantId = self.ctx.dashboard.authUser.tenantId
let asset = {
additionalInfo: null,
createdTime: 1599121131415, // временно
customerId: {
entityType: "CUSTOMER",
id: self.ctx.dashboard.authUser.customerId
},
id: {
entityType: "ASSET",
id: activeID
},
label: null,
name: "kuku", // временно
tenantId: {
entityType: "TENANT",
id: tenantId
},
type: "справочник"
}
assetService.saveAsset(asset)
Thingsboard is built using Angular 10 currently See releases. You correctly injected the Angular service 'assetService'. You need to follow the Angular method of subscribing to the observable from assetService.
Calling
assetService.saveAsset(asset)
without subscribing means nothing happens. From the Angular University Blog
The multiple versions of the Angular HTTP module all have an RxJS Observable-based API. This means that the multiple calls to the HTTP module will all return an observable, that we need to subscribe to one way or the other.
So here's the code to 'subscribe' to the observable described above
assetService.saveAsset(asset).subscribe(
(response) => {
console.log(
"saveAsset call Success:",
response);
},
response => {
console.log(
"saveAsset call Error:",
response);
},
() => {
console.log(
"saveAsset observable Complete"
);
});
Let me know if there's a mistake in the code above, I didn't test it. And thanks for your question Anzor - it led me to a solution to make a custom Thingsboard widget along with the Widgets Development Guide.

cannot set the Sync document's ttl from a twilio function runtime client

I need my twilio sync documents to be deleted automatically after few minutes.
I followed the documentation for the Runtime.getSync(),
which by the way seems to be introduced here
https://www.twilio.com/docs/runtime/client and extended by the
"Documents" section here
https://www.twilio.com/docs/sync/api/documents using node.js examples,
it was so hard to piece it all toghether.
but I cannot get the ttl parameter to work
exports.handler = function(context, event, callback) {
let sync = Runtime.getSync();
let payload = {
'greeting': "bonbon!"
};
let uniqueName = "test4";
sync.documents.create({
uniqueName: uniqueName,
ttl: 5, //////////////////DOESN'T WORK!!!
data: payload
}).then(function(response) {
console.log(response);
callback(null, response);
});
}
the ttl parameter doesn't cause any effect on the expiration of the document and doesn't even cause the document's parameter "date_expires" (as seen in the https://www.twilio.com/docs/sync/api/documents ecample) to reflect the right value, in fact the date_expires parameter doesn't even appear in the returned JSON object:
{
_version: {
_domain: {
twilio: {
username: "xxxxxxxxxxxxxxxxxxxxxx",
password: "[Redacted]",
accountSid: "xxxxxxxxxxxxxxxxxxxxxx",
httpClient: { },
_sync: {
$ref: "$["_version"]["_domain"]"
}
},
baseUrl: "https://sync.twilio.com",
_v1: {
$ref: "$["_version"]"
}
},
_version: "v1"
},
sid: "xxxxxxxxxxxxxxxxxxxxxx",
uniqueName: "test4",
accountSid: "xxxxxxxxxxxxxxxxxxxxxx",
serviceSid: "xxxxxxxxxxxxxxxxxxxxxx",
url: "https://sync.twilio.com/v1/Services/xxxxxxxxxxxxxxxxxxxxxx/Documents/xxxxxxxxxxxxxxxxxxxxxx",
links: {
permissions: "https://sync.twilio.com/v1/Services/xxxxxxxxxxxxxxxxxxxxxx/Documents/xxxxxxxxxxxxxxxxxxxxxx/Permissions"
},
revision: "0",
data: {
greeting: "bonbon!"
},
dateCreated: "2018-09-19T03:30:24.000Z",
dateUpdated: "2018-09-19T03:30:24.000Z",
createdBy: "system",
_solution: {
serviceSid: "default",
sid: "xxxxxxxxxxxxxxxxxxxxxx"
}
}
is there anyone who has an explanation or a workaround?
Thank you very much in advance
Which version of twilio do you use?
https://www.twilio.com/console/runtime/functions/configure
If it is less than 3.6.10, ttl is not supported.
https://github.com/twilio/twilio-node/blob/master/CHANGES.md#2017-11-17-version-3100
[2017-11-17] Version 3.10.0
Sync
Add TTL support for Sync objects (breaking change)
The newest version is 3.21.0. Try it.

Using the Javascript Fetch API with Hapi

I created a simple API with Hapi that has a route I can POST to, which looks like this:
server.route({
method: "POST",
path: "/hello",
handler: function(request, reply) {
// It doesn't ever get to here
return reply({hello: request.payload.name});
},
config: {
validate: {
payload: {
name: Joi.string().required()
}
}
}
});
I can successfully send a POST request to this path in Postman:
It returns the expected response. But, when I use this piece of Javascript to send the request:
fetch("http://localhost:1111/hello", {
mode: "cors"
body: {name: "John Doe"}
}).then(() => {
console.log("yay! it worked");
});
This fails, and says "value" must be an object.
It turns out, I just needed to stringify the JSON first, and then it worked:
fetch("http://localhost:1111/hello", {
mode: "cors"
body: JSON.stringify({name: "John Doe"})
}).then(() => {
console.log("yay! it worked");
});

JIRA API after POST returns { errorMessages: [ 'Internal server error' ], errors: {} }

I am trying to create a new issue utilizing the JIRA REST API and whenever I try, I get back the following generic error:
{ errorMessages: [ 'Internal server error' ], errors: {} }
I can successfully GET from the API, and the credentials I'm connecting with have full Admin access to JIRA (so it's not an Auth issue), but I get this error every time with POST. Below is a snippet of the JSON data I'm sending. Am I missing anything obvious?
Below is my JavaScript code. Note I'm using jira-connector from npm. (Real domain replaced with mydomain for this sample code)
const JiraClient = require('jira-connector');
const dotenv = require('dotenv').config();
function createNewIssue(fields) {
const encoded = process.env.JIRA_ENCODED_PW;
const jira = new JiraClient({
host: 'mydomain.atlassian.net',
basic_auth: {
base64: encoded
}
});
return new Promise((resolve, reject) => {
jira.issue.createIssue(fields, (error, issue) => {
if (error) {
console.log(error);
reject(error);
} else {
console.log(issue);
resolve(encoded);
}
});
})
}
Below is the JSON that's being passed into fields in the JS above. Note customfield_17300 is a radio button, and customfield_17300 is a multi-select box. For both cases, I've tried using the "id" and also the actual string "name" value. All IDs below were taken straight from a API GET of the same issue in question:
{
"fields": {
"project": {
"id": "13400"
},
"summary": "TEST API TICKET - 01",
"issuetype": {
"id": "11701"
},
"customfield_14804": { "id": "13716" },
"customfield_14607": "Hardware",
"customfield_17300": [
{
"id": "18322"
}
] ,
"customfield_16301": "Customer PO",
"customfield_14800": "LA, California",
"customfield_16302": "FEDEX 234982347g"
}
}
sigh I figured it out... other posts that said this cryptic error was due to a malformed JSON were correct.
In my route, I passed fields as coming from req.body.fields which actually dove into the fields values instead of passing it straight through. This made it so that when the JSON was sent to JIRA the fields outer wrapper was missing. I changed my route to pass along req.body instead of req.body.fields and all was well.
...that was a fun 4 hours...

ExtJS4.1: Why model.save() sends wrong thing to server?

I tried to use model.save() to POST a new user. But I check request payload and found that it not only sent the data, but also sent other parts of the model. That makes my server cannot parse the payload.
The request payload generated :
{"phantom":true,"internalId":"ext-record-58","raw":{},"data":{"userId":0,"userName":"Amy"},"modified":{"userName":""},"hasListeners":{},"events":{},"stores":[],"dirty":true,"id":"AM.model.User-ext-record-58"}
But the desired request payload should be :
{"userId":0,"userName":"Amy"}
And I am aware that the "phantom" of my model is false before I call model.save(). But it becomes true in the request payload. Is it a clue?
Model:
Ext.define('AM.model.User',{
extend: 'Ext.data.Model',
fields: [
{ name: 'userId', type: 'int' },
{ name: 'userName', type: 'string' },
{ name: 'createdTime', type: 'string' },
],
idProperty: 'userId',
associations: [
{
type: 'hasOne',
model: 'AM.model.ModelA',
name:'modelA',
associationKey:'modelA',
getterName:'modelA'
},
{
type: 'hasOne',
model: 'AM.model.ModelB',
name:'modelB',
associationKey:'modelB',
getterName:'modelB'
}
],
proxy: {
type: 'rest',
success:true,
url:'../restful/users',
writer:{
type:'json',
getRecordData:function(record){ //parse createdTime to the format Y-m-d
record.set('createdTime', Ext.Date.format(new Date(record.get('createdTime')), "Y-m-d"));
return record;
}
},
reader: {
type: 'json'
}
}
});
This is the view which has the data to be posted. The view will fill the data to the model:
Ext.define('AM.view.UserRegisterForm',{
extend:'Ext.form.Panel.',
alias:'widget.userRegisterForm',
fields:new Array(), //I want to render the fields in xtemplate, so instead of adding the fields to items, I use an array to manage them.
retrieveData(model){
model.set('userName', this.fields[0].getValue());
model.set('createdTime',this.fields[1].getValue());
}
}
The function in the controller, which sends the POST request:
postUser:function(){
var userRegisterForm= this.getUserRegisterForm();
var userModel = this.getUserModel();
var user= new userModel();
var me = this;
userRegisterForm.retrieveFieldData(user);
console.log(user); //the data in console looks fine!
user.save({
success: function(response) {
//do something...
},failure:function(response) {
alert('fail');
}
});
}
You are returning the full record when you override getRecordData Where as you are just meant to return the records data. record.getData()
Some extra advice. Don't override getRecordData to set the models creation date. Use the models defaultValue property to give assign it a new Date if one doesn't exist.

Resources