kaltura vpaas api, which property do I use to modify the co-editor or co-publsher - kaltura

{ "adminTags": "", "allowedPartnerIds": "", "allowedPartnerPackages": "", "city": "", "country": "", "createdAt": 0, "deletedAt": 0, "description": "", "email": "", "fullName": "", "id": "", "indexedPartnerDataInt": 0, "indexedPartnerDataString": "", "language": "aa", "lastLoginTime": 0, "objectType": "KalturaUser", "partnerData": "", "partnerId": 0, "screenName": "", "state": "", "status": 0, "statusUpdatedAt": 0, "storageSize": 0, "tags": "", "thumbnailUrl": "", "updatedAt": 0, "userMode": 0, "zip": "", "attendanceInfo": "", "dateOfBirth": 0, "firstName": "", "gender": 0, "isAccountOwner": true, "isAdmin": true, "lastName": "", "loginEnabled": true, "password": "", "registrationInfo": "", "roleIds": "", "roleNames": "", "type": 0 }
I am pretty new to using the kaltura api. I want to dynamically adjust some of the objects via the api. For instance, the co-editor or co-partner, but I do not see in the object, which do I use or what actions in the documentations do you recommend?

If the property doesn't exist on the object (in your case the KalturaUser) then it is not updateable this object service (REST API).
You can find the documentation here.
I think you meant to update the co-editor / co-partner on the entry object - as each entry can have entitledUsersEdit / entitledUsersPublish fields which can contain list of user IDs. You can see example here.
So, after you have the user id from the object you have - you can use the baseEntry.update (from the link above) to set your user as co-editor/co-partner to the entry

Related

Need to pass 1 gameID to 9 different users (Signed up and logged in) which is created at the run time of previous request

I have multiple requests in the same thread group and i need to pass 18 users to the 2 game id's (9 users to each gameID) and i am using counter element to create different users and gameID's.
Login Request:
42[
"get_login",
{
"uid": "EiNjkkkxgqq1ClN7gwzJEBK5XPhYKsG5",
"key": "AUEEW891WL",
"socketId":"AvKjxCGPLzgvqGxzAAb-",
"username": "",
"avatar": "",
"language": "en",
"playerMove": "",
"joinGame": "",
"replay": 0,
"gameID": 0,
"gameNo": 0,
"data": "&email=Nov${counter}#gmail.com&password=poker",
"players": 0,
"level": "",
"lastAction": "",
"game": "",
"playMoney": 1,
"role": ""
}
]
Response:
42[
"gotLogin",
{
"response": {
"playerId": 24441,
"totalWin": 0,
"points": 0,
"playerName": "672319400464",
"displayName": "DEC65",
"playerRank": "Amateur",
"playerBank": "11K",
"playerBankAmount": 11000,
"playerAvatar": "avatar1.jpg",
"playerEmail": "Nov65#gmail.com",
"playerLevel": 1,
"playerLevelStr": "Lvl. 1",
"playerLevelPrg": 0,
"playerLevelPoints": 100,
"playerGold": 0,
"playerDealerId": 1,
"playerFbId": "",
"loadVocab": "",
"dailyBonus": 0,
"token": "37333e039503825fded65f7714f04741688af294ff0a32a7c676f5c366e193de"
}
}
]
Create Game
Request:
42[
"create_game",
{
"uid": "Esdv7CHkwo1ATMfvY6NcWBTM5YB4d3nj",
"key": "AUEEW891WL",
"socketId":"AvKjxCGPLzgvqGxzAAb-",
"username": "611839990703",
"avatar": "avatar17.jpg",
"language": "en",
"playerMove": "",
"joinGame": "",
"replay": 0,
"gameID": 0,
"gameNo": 0,
"data": "&gameID=undefined&game=texas&playMoney=1&gameStyle=private-cashgame&tableName=TableOct${counter}&rakeRate=0&speed=60&sb=10&bb=20&tablelow=100&tablelimit=1000&videorequired=false&username=611839990703",
"players": 0,
"level": 347,
"lastAction": "",
"game": "",
"playMoney": 1,
"role": "1",
"token":"84d26de7404377dfa0ade2ff74676fd901852e19100068d43ac8a8d449f49a1c",
"playerId":"23910",
"displayName": "p10"
}
]
Response:
42[
"createGameRsp",
{
"response": {
"title": "Create Successful",
"result": "TableOct2 was successfully created. \n GameID: 630 \n Password: ",
"error": "",
"game": "texas",
"gameID": 630
}
}
]
Join Game:
Request:
42[
"get_joingame",
{
"uid": "Esdv7CHkwo1ATMfvY6NcWBTM5YB4d3nj",
"key": "AUEEW891WL",
"socketId":"AvKjxCGPLzgvqGxzAAb-",
"username":${userName}",
"avatar": "avatar17.jpg",
"language": "en",
"playerMove": "",
"joinGame": "",
"replay": 0,
"gameID":"${gameID}",
"gameNo": 0,
"data": "&seat=${counter2}&buyin=500&privateTable=2&clubId=0",
"players": 0,
"level": 347,
"lastAction": "ep.playNow",
"game": "texas",
"playMoney": 1,
"role": "1",
"playerId":"${playerId}",
"displayName": "p10",
"seat":${counter2}
}
]
Response:
42[
"gotJoinGame",
{
"game": "texas",
"gameID": "630",
"response": {
"error": ""
}
}
]
Right now i am able to pass one game id to only one user. But i need to pass one game id to 9 users. How is it possible?
As per JMeter documentation on variables:
Properties are not the same as variables. Variables are local to a thread; properties are common to all threads
So if you extract the gameID by one thread (virtual user) - it will be available only to this thread. If you want to use the value by other virtual user(s) - you need to convert it into a JMeter Property via __setProperty() function or suitable JSR223 Test Element
If you have 2 groups of users you can assign one gameID to users with even thread number and the other to odd users.
More information: Using JMeter Variables With Multiple Thread Groups

Nifi - Route the JSON based on the Array Name

I am new to Nifi, i hv a requirement where we get multiple JSON inputs with different Header Names. I have to parse the JSON and insert into different tables based on the Header value.
Not sure how to use RouteonContent processor or EvaluateJSON Path processor
Input 1
{
"Location": [
{
"country": "US",
"division": "Central",
"region": "Big South",
"locationID": 1015,
"location_name": "Hattiesburg, MS (XF)",
"location_type": "RETAIL",
"location_sub_type": "COS",
"store_type": "",
"planned_open_date": "",
"planned_close_date": "",
"actual_open_date": "2017-07-26",
"actual_close_date": "",
"new_store_flag": "",
"address1": "2100 Lincoln Road",
"address2": "",
"city": "Hattiesburg",
"state": "MS",
"zip": 39402,
"include_for_planning": "Y"
},
{
"country": "US",
"division": "Central",
"region": "Big South",
"locationID": 1028,
"location_name": "Laurel, MS",
"location_type": "RETAIL",
"location_sub_type": "COS",
"store_type": "",
"planned_open_date": "",
"planned_close_date": "",
"actual_open_date": "",
"actual_close_date": "",
"new_store_flag": "",
"address1": "1225 5th street",
"address2": "",
"city": "Laurel",
"state": "MS",
"zip": 39440,
"include_for_planning": "Y"
}
]
Input 2
{
"Item": [
{
"npi_code": "NEW",
"cifa_category": "XM",
"o9_category": "Accessories"
},
{
"npi_code": "NEW",
"cifa_category": "XM0",
"o9_category": "Accessories"
}
]
Use the website https://jsonpath.com/ to figure out the proper JSON expression. But what you could potentially do is use: if the array contains either $.npi_code then do X and if it contains $. country, then do Y

Laravel, appending an attribute to a returned json appends the entire object

I have 2 tables Customer(Parent) and jobCode(Child) with one to many relationships
I want to retrieve a child record but with one extra field from the parent (customerGuid) as well. My code:
$jobCodes=JobCode::all();
foreach ($jobCodes as $jobCode) {
$jobCode['customerGuid']=$jobCode->customer->guid;
// I also tried $jobCode->setAttribute('customerGuid',$jobCode->customer->guid);
}
return $jobCodes;
I was expecting just the parent's guid field to be appended to each jobCode object and returned. However the ENTIRE customer parent object is returned!
[{
"id": 137,
"customerId": 1,
"jobCode": "Journeyman Plumber",
"jobDescription": "Journeyman Plumber",
"created_at": null,
"updated_at": "2017-01-27 12:20:27",
"guid": "28f35e94-e483-11e6-98e9-e0db55883624",
"customerGuid": "8d48931d-dc61-11e6-8927-e0db55883624",
"customer": {
"id": 1,
"name": "ACME",
"address1": "",
"address2": "",
"city": "San Jose",
"zip": "",
"phone": "",
"fax": "",
"email": "",
"guid": "8d48931d-dc61-11e6-8927-e0db55883624",
"stateName": "California",
"created_at": null,
"updated_at": "2017-01-20 07:10:59"
}
}, {
"id": 138,
"customerId": 1,
"jobCode": "JRP PreFab",
"jobDescription": "JRP",
......,
Its because your return statement returns $jobCodes; which is the entire table you retrieve here: $jobCodes=JobCode::all();
try putting this inside your loop
echo '$jobCode' to see what is the output every time it loops
Reaching for the relationship customer on $jobCode you automatically lazy load the relationship object, which is stored in $jobCode->customer attribute.
Try this instead just returning the collection:
// return $jobCodes;
return $jobCodes->map(function($jobCode){
$jobCode = $jobCode->toArray();
unset($jobCode['customer']);
return $jobCode;
});

create incident through webservice in servicenow not creating incident number

I am creating an incident via web service by reading incident json data from a txt file. The incident gets created but the incident number field is empty in the generated incident in my instance(Fiji). I am setting the incident number in the input json data. I wanted to know if we can specify the incident number in the input json data or have the table auto generate the incident number.
Regards,
Priyank
I was curious about your question so I went ahead a tried making a rest call with just the description in the data payload to see what would happen
var requestBody = "{'description':'oh boy'}";
var client=new XMLHttpRequest();
client.open("post","https://scdevelopment.service- now.com/api/now/table/incident");
client.setRequestHeader('Accept','application/json');
client.setRequestHeader('Content-Type','application/json');
//Eg. UserName="admin", Password="admin" for this code sample.
client.setRequestHeader('Authorization', 'Basic '+btoa('DELETED'+':'+'DELETED'));
client.onreadystatechange = function() {
if(this.readyState = this.DONE) {
document.getElementById("response").innerHTML=this.status + this.response;
}
};
client.send(requestBody);
Here is the default JavaScript help from the REST API Explorer. You can see I am just sending a requestBody with the description field.
And here's the response I get
{"result": {
"skills": "",
"upon_approval": "proceed",
"location": "",
"expected_start": "",
"reopen_count": "0",
"close_notes": "",
"additional_assignee_list": "",
"impact": "3",
"urgency": "3",
"correlation_id": "",
"sys_tags": "",
"sys_domain": {
"link": "DELETED",
"value": "global"
},
"description": "oh boy",
"group_list": "",
"priority": "5",
"delivery_plan": "",
"sys_mod_count": "0",
"work_notes_list": "",
"business_service": "",
"follow_up": "",
"closed_at": "",
"sla_due": "",
"delivery_task": "",
"sys_updated_on": "2016-02-28 22:16:26",
"parent": "",
"work_end": "",
"number": "INC0010233",
"closed_by": "",
"work_start": "",
"calendar_stc": "",
"u_votes": "0",
"category": "",
"business_duration": "",
"incident_state": "1",
"activity_due": "",
"correlation_display": "",
"company": {
"link": "DELETED"
},
"active": "true",
"due_date": "",
"assignment_group": "",
"caller_id": {
"link": "DELETED",
"value": "ef04eb560f46c240d0db715be1050e59"
},
"knowledge": "false",
"made_sla": "true",
"comments_and_work_notes": "",
"parent_incident": "",
"state": "1",
"user_input": "",
"sys_created_on": "2016-02-28 22:16:26",
"approval_set": "",
"reassignment_count": "0",
"rfc": "",
"child_incidents": "0",
"opened_at": "2016-02-28 22:16:26",
"short_description": "",
"order": "",
"sys_updated_by": "aj.siegel",
"resolved_by": "",
"notify": "1",
"upon_reject": "cancel",
"approval_history": "",
"problem_id": "",
"work_notes": "",
"calendar_duration": "",
"close_code": "",
"sys_id": "69258f6e133d5200ca3db1676144b01a",
"approval": "not requested",
"caused_by": "",
"severity": "3",
"sys_created_by": "aj.siegel",
"resolved_at": "",
"assigned_to": "",
"business_stc": "",
"wf_activity": "",
"cmdb_ci": "",
"opened_by": {
"link": "DELETED",
"value": "ef04eb560f46c240d0db715be1050e59"
},
"subcategory": "",
"rejection_goto": "",
"sys_class_name": "incident",
"watch_list": "",
"time_worked": "",
"contact_type": "phone",
"escalation": "0",
"comments": ""
}
}
Notice "number": "INC0010233",
Yay, autogenerated incident number.

Why won't Appcelerator Titanium Mobile parse this JSON?

Using 1.4.1 against Android under Windows 7. I have a web service being access from the Titanium application, the service returns JSON like this:
{
"VFPData": {
"rows": [
{
"address1": "Orion House",
"address2": "Orion Way",
"address3": "Kettering",
"address4": "Northants",
"comp_name": "Orion Vehicles Leasing",
"contid": 1,
"email": "",
"email2": "",
"fax": "",
"firstname": "David John",
"lastname": "Sear",
"mobile": "",
"phone1": "",
"phone2": "",
"postcode": "NN15 6PE"
},
{
"address1": "Unit 20 Acton Business Park",
"address2": "Acton Lane",
"address3": "London",
"address4": "",
"comp_name": "Orion Vehicles Limited",
"contid": 2,
"email": "Mark#ovl.co.uk",
"email2": "",
"fax": "",
"firstname": "Mark",
"lastname": "Johnson",
"mobile": "0888 566 67879",
"phone1": "0208 209 1359",
"phone2": "",
"postcode": "NW10 7NH"
}
]
}
}
However no combination of eval or JSON.parse will return a valid result - for example:
var contacts = JSON.parse(this.responseText);
alert(contacts.length);
That will show an alert dialog with nothing in it. The Titanium HTTPClient calls are working fine as I can
Ti.debug(this.responseText)
with no problem.
That JSON validates OK as well, in jsonlint.com for example.
The JSON looks fine, and parses fine... but is the line:
alert(contacts.length);
the only part that leads you to believe it isn't working? Because you can't get the length of an object (VFPData)... you'll get undefined/null whether valid parsing happened or not. A better test is:
alert(contacts.VFPData.rows.length);
... since you know rows is an array. Or:
alert(contacts);
Which should report it's an object (if parsed) or null/undefined otherwise.

Resources