Why a member cannot receive messages from others in a group call chat of Teams - microsoft-graph-api

I used Create Call of Microsoft Graph API to create a group call(audio). The connection has created successfully, but every member cannot receive any chat message posted by other members.
(picture)The phenomenon that everyone cannot receive other's message
Request as below:
POST https://graph.microsoft.com/beta/app/calls
Content-Type: application/json
Authorization: Bearer <Token>
{
"#odata.type": "#microsoft.graph.call",
"callbackUri": "https://myhostname.ngrok.io/callback/calling",
"mediaConfig": {
"#odata.type": "#microsoft.graph.serviceHostedMediaConfig"
},
"source": {
"identity": {
"application": {
"id": "myCallingAppId"
}
}
},
"subject": "Test Call",
"targets": [
{
"identity": {
"user": {
"id": "User_1-Id",
"displayName": "User_1-DisplayName"
}
},
"identity": {
"user": {
"id": "User_2-Id",
"displayName": "User_2-Name"
}
}
}
],
"tenantId": "myCallingAppTenant"
}
Response:
{
"#odata.context": "https://graph.microsoft.com/beta/$metadata#communications/calls/$entity",
"id": "481f0c00-ffff-41cd-bbc8-7e21fb5e8b1b",
"state": "establishing",
"transferState": null,
"terminationReason": null,
"direction": "outgoing",
"ringingTimeoutInSeconds": null,
"subject": "Test Call",
"callbackUri": "https://myhostname.ngrok.io/callback/calling",
"requestedModalities": [],
"activeModalities": [],
"routingPolicies": [],
"tenantId": "myCallingAppTenant",
"myParticipantId": "59e11e38-87d0-4ae5-b3ce-051ea26aa34d",
"mediaState": null,
"resultInfo": null,
"answeredBy": null,
"chatInfo": null,
"meetingInfo": null,
"meetingCapability": null,
"toneInfo": null,
"incomingContext": null,
"callRoutes": [],
"source": {
"region": null,
"languageId": null,
"identity": {
"user": null,
"device": null,
"phone": null,
"application": {
"id": "myCallingAppId",
"displayName": null
}
}
},
"targets": [
{
"region": null,
"languageId": null,
"identity": {
"application": null,
"device": null,
"phone": null,
"user": {
"id": "User_1-Id",
"displayName": "User_1-DisplayName"
}
}
},
{
"region": null,
"languageId": null,
"identity": {
"application": null,
"device": null,
"phone": null,
"user": {
"id": "User_2-Id",
"displayName": "User_2-DisplayName"
}
}
}
],
"mediaConfig": {
"#odata.type": "#microsoft.graph.serviceHostedMediaConfig",
"removeFromDefaultAudioGroup": null,
"preFetchMedia": []
}
}
Is any configuration missed. How to create a calling with normal message communication. Could anyone help me, thanks!

Related

Retrieve homePhone, mobilePhone and faxPhone from Delve Profile using Graph API

I am trying to retrieve the information in the red box via the graph api resource:
https://graph.microsoft.com/beta/me/profile
Here is the return:
"phones": [
{
"displayName": null,
"type": "business",
"number": "xxxxxxxxxx",
"allowedAudiences": "organization",
"createdDateTime": "2021-06-21T23:36:38.0912984Z",
"inference": null,
"lastModifiedDateTime": "2021-06-21T23:36:38.0912984Z",
"id": "a28e87ba-25xx-45xx-8fxx-5f340b597fxx",
"isSearchable": false,
"createdBy": {
"device": null,
"user": null,
"application": {
"displayName": "AAD",
"id": null
}
},
"lastModifiedBy": {
"device": null,
"user": null,
"application": {
"displayName": "AAD",
"id": null
}
},
"source": {
"type": [
"AAD"
]
}
}
],
It looks to only be returning the info from AAD, not the fields in the Delve profile. Upon further research I found these fields are actually linked to the SharePoint online profile. Is there a way to grab this information using the Graph API?

How to bypass errors and parse json field values

How to deserialize below JSON?
When i am using below code
Response response=engine.getResponse(Method.GET,strURL,strBAUsername,strBAPassword,null,ContentType.JSON);
userEdit=response.as(TestUserRoleInfoList.class); // TestUserRoleInfoList is a POJO class
#JsonIgnoreProperties(ignoreUnknown=true)
public class TestUserRoleInfoList {
#JsonProperty("userRoleInfoList")
List<UserRoleInfo> userRoleInfo=new ArrayList<UserRoleInfo>();
public List<UserRoleInfo> getUserRoleInfo() {
return userRoleInfo;
}
public void setUserRoleInfo(List<UserRoleInfo> userRoleInfo) {
this.userRoleInfo = userRoleInfo;
}
}
Somehow it unable to parse Regions internal class. But i am least bothered. I need collectionRole fields.
How can i get the list of collection roles?
{
"id": 5595,
"userName": "abc",
"firstName": "abc",
"lastName": "ijk",
"additionalName": "Ernest",
"namePrefix": {
"id": null,
"prefix": null,
"createdAt": null,
"updatedAt": null
},
"nameSuffix": {
"id": null,
"suffix": null,
"createdAt": null,
"updatedAt": null
},
"emplId": "11111",
"workDayId": "11111",
"staffEmailAddress": null,
"facultyEmailAddress": "abc.xyz#xxxx.edu",
"userRoleInfoList": [
{
"userId": 5595,
"collectionRole": "program-chair",
"regions": [
{
"id": 1,
"region": "Germany 1",
"regionalDirectorFirstName": "aaaa",
"regionalDirectorLastName": "bbbb",
"associateDirectorFirstName": null,
"associateDirectorLastName": null,
"division": {
"id": 2,
"name": "Europe",
"deletedFlag": false,
"createdAt": null,
"updatedAt": null
},
"deletedFlag": false,
"createdAt": null,
"updatedAt": null
}
],
"school": {
"id": 3,
"name": "Arts and Sciences",
"dean": null,
"createdAt": null,
"updatedAt": null
},
"facultyPhoto": null,
"primary": false
},
{
"userId": 5595,
"collectionRole": "faculty",
"regions": [
{
"id": 3,
"region": "Germany 1",
"regionalDirectorFirstName": "aaaa",
"regionalDirectorLastName": "bbbb",
"associateDirectorFirstName": null,
"associateDirectorLastName": null,
"division": {
"id": 2,
"name": "Europe",
"deletedFlag": false,
"createdAt": null,
"updatedAt": null
},
"deletedFlag": false,
"createdAt": null,
"updatedAt": null
}
],
"school": {
"id": 3,
"name": "Arts and Sciences",
"dean": null,
"createdAt": null,
"updatedAt": null
},
"facultyPhoto": null,
"primary": true
}
]
}
You can use org.json.JSONObject
Response response = when()
.get("api_url")
.then()
.extract().response();
JSONObject jsonObject = new JSONObject(response.getBody().asString());
JSONArray jsonArray = jsonObject.getJSONArray("userRoleInfoList");
List<String> stringList = new ArrayList<>();
for (int i = 0; i < jsonArray.length(); i++) {
stringList.add(jsonArray.getJSONObject(i).getString("collectionRole"));
}
System.out.println(stringList);
This will output [program-chair, faculty]

Filter contacts in outlook API using startswith()

I am trying to get a list of contacts that are filtered by email address from Microsoft Outlook API (Contact API). The url I am using for the request is:
https://outlook.office.com/api/v2.0/me/contacts/?$filter=EmailAddresses/any(email: startswith(email/Address,'ab'))
The filter property $filter=EmailAddresses/any(email: email/Address eq 'ab') is working fine.
Here EmailAddresses field is a list containing name, address fields.
UPDATE
Original response :
{
"#odata.context": "https://outlook.office.com/api/v2.0/$metadata#Me/Contacts",
"value": [
{
..................................
..................................
"DisplayName": "Abhishek R",
"GivenName": "Abhishek",
"Initials": null,
"MiddleName": null,
"NickName": null,
"Surname": "R",
"Title": null,
"YomiGivenName": null,
"YomiSurname": null,
"YomiCompanyName": null,
"Generation": null,
"ImAddresses": [],
"JobTitle": null,
"CompanyName": null,
"Department": null,
"OfficeLocation": null,
"Profession": null,
"BusinessHomePage": null,
"AssistantName": null,
"Manager": null,
"HomePhones": [],
"MobilePhone1": null,
"BusinessPhones": [],
"SpouseName": null,
"PersonalNotes": null,
"Children": [],
"EmailAddresses": [
{
"Name": "abhishek#gmail.com",
"Address": "abhishek#gmail.com"
},
{
"Name": "abcdef#gmail.com",
"Address": "abcdef#gmail.com"
}
],
"HomeAddress": {},
"BusinessAddress": {},
"OtherAddress": {}
}
]
}
The response I got is:
{
"error": {
"code": "ErrorInvalidUrlQueryFilter",
"message": "The query filter contains one or more invalid nodes."
}
}
Looking for a solution to this.

Neo4j.rb : transfer all relationships before replacing a node by another

I'm trying to transfert all ingoing and outgoing relationships (including their properties) from a node to another, before deleting the first one. they both have the same label.
The discussion started here :
Neo4j Cypher : transfer all relationships before replacing a node by another
node_query = Neo4j::Session.query.match(old_node: {uuid: node1.uuid}).match(new_node: {uuid: node2.uuid})
types = node_query.match('node-[rel]-()').pluck('DISTINCT type(rel)')
types.each do |type|
node_query.match('old_node-[rel]->(other)').with(:old_node, :rel, :other).create("new_node-[new_rel]->other").set('new_rel = rel').exec
node_query.match('old_node<-[rel]-(other)').with(:old_node, :rel, :other).create("new_node<-[new_rel]-other").set('new_rel = rel').exec
end
When i tried to implement that i get this error
new_rel not defined (line 1, column 160)
"MATCH
(old_node {uuid: "YYYY"}),
(new_node {uuid: "XXXX"}),
oldnode-[rel]->(other)
WITH old_node, rel, other SET new_rel = rel
CREATE new_node-[new_rel]->other" ^
I tried another way which works only for the Neo4j::ActiveRel rels, beacause for the others there's no to_node property. It seems that it doesn't copy the relationship properties anyway :
relations = old_node.rels(dir: :outgoing)
relations.each do |rel|
if defined? rel.to_node
new_node.create_rel(rel.type, rel.to_node, rel.props)
end
end
relations = self.rels(dir: :incoming)
relations.each do |rel|
if defined? rel.from_node
rel.from_node.create_rel(rel.type, new_node, rel.props)
end
end
Ah, now that I see the error I think I know what was wrong with the original answer. I'll look at your other solution too, but here is how I would fix the original (by adding a break to make the SET come after the CREATE):
# Assuming node already loaded
node_query = Neo4j::Session.query.match(node: {neo_id: node.neo_id}, new_node: {neo_id: new_node.neo_id})
types = node_query.match('node-[rel]-()').pluck('DISTINCT type(rel)')
types.each do |type|
node_query.match('node-[rel:#{type}]->(other)').
where('other <> new_node').
with(:node, :new_node, :rel, :other).
create("new_node-[new_rel:#{type}]->other").
break.set('new_rel = rel').exec
node_query.match('node<-[rel:#{type}]-(other)').
where('other <> new_node').
with(:node, :new_node, :rel, :other).
create("new_node<-[new_rel:#{type}]-other").
break.set('new_rel = rel').exec
end
As to your other solution, I'm not too familiar with the rels method (and I can't seem to find it), but I imagine it's returning either CypherRelationship or ActiveRel objects. I'm actually a bit surprised it only works if you define ActiveRel models, because it should return CypherRelationship objects if one isn't defined.
My guess as to your problem, though, is that you probably need to use start_node and end_node instead of from_node and to_node. We should probably standardize that...
EDIT : i'm editing this to add the Neo4j::Server::CypherRelationship that is returned when it's not an ActiveRel. there's no start_node nor from node :
{
"session": {
"connection": {
"parallel_manager": null,
"headers": {
"Content-Type": "application/json",
"User-Agent": "neo4j-gem/4.1.2 (https://github.com/neo4jrb/neo4j)",
"Authorization": "Basic realm=\"Neo4j\" OjdhYTUxNTcyYzBmMzBkYTMyNmY0NWQwMDc4ZTRlY2Rk"
},
"params": {},
"options": {
"params_encoder": null,
"proxy": null,
"bind": null,
"timeout": null,
"open_timeout": null,
"boundary": null,
"oauth": null
},
"ssl": {
"verify": null,
"ca_file": null,
"ca_path": null,
"verify_mode": null,
"cert_store": null,
"client_cert": null,
"client_key": null,
"certificate": null,
"private_key": null,
"verify_depth": null,
"version": null
},
"default_parallel_manager": null,
"builder": {
"handlers": [
{
"name": "Faraday::Request::BasicAuthentication",
"args": [
"neo4j",
"hroads"
],
"block": null
},
{
"name": "FaradayMiddleware::EncodeJson",
"args": [],
"block": null
},
{
"name": "FaradayMiddleware::ParseJson",
"args": [
{
"content_type": "application/json"
}
],
"block": null
},
{
"name": "Faraday::Adapter::NetHttpPersistent",
"args": [],
"block": null
}
],
"app": {
"header_value": "Basic bmVvNGo6aHJvYWRz",
"app": {
"app": {
"app": {
"app": {}
},
"options": {
"content_type": "application/json"
},
"content_types": [
"application/json"
]
}
}
}
},
"url_prefix": {
"scheme": "http",
"user": null,
"password": null,
"host": null,
"port": 80,
"path": "/",
"query": null,
"opaque": null,
"registry": null,
"fragment": null,
"parser": null
},
"proxy": null
},
"auth": {
"url": "http://localhost:7474",
"connection": {
"parallel_manager": null,
"headers": {
"Content-Type": "application/json",
"User-Agent": "neo4j-gem/4.1.2 (https://github.com/neo4jrb/neo4j)",
"Authorization": "Basic realm=\"Neo4j\" OjdhYTUxNTcyYzBmMzBkYTMyNmY0NWQwMDc4ZTRlY2Rk"
},
"params": {},
"options": {
"params_encoder": null,
"proxy": null,
"bind": null,
"timeout": null,
"open_timeout": null,
"boundary": null,
"oauth": null
},
"ssl": {
"verify": null,
"ca_file": null,
"ca_path": null,
"verify_mode": null,
"cert_store": null,
"client_cert": null,
"client_key": null,
"certificate": null,
"private_key": null,
"verify_depth": null,
"version": null
},
"default_parallel_manager": null,
"builder": {
"handlers": [
{
"name": "Faraday::Request::BasicAuthentication",
"args": [
"neo4j",
"hroads"
],
"block": null
},
{
"name": "FaradayMiddleware::EncodeJson",
"args": [],
"block": null
},
{
"name": "FaradayMiddleware::ParseJson",
"args": [
{
"content_type": "application/json"
}
],
"block": null
},
{
"name": "Faraday::Adapter::NetHttpPersistent",
"args": [],
"block": null
}
],
"app": {
"header_value": "Basic bmVvNGo6aHJvYWRz",
"app": {
"app": {
"app": {
"app": {}
},
"options": {
"content_type": "application/json"
},
"content_types": [
"application/json"
]
}
}
}
},
"url_prefix": {
"scheme": "http",
"user": null,
"password": null,
"host": null,
"port": 80,
"path": "/",
"query": null,
"opaque": null,
"registry": null,
"fragment": null,
"parser": null
},
"proxy": null
},
"params": {
"basic_auth": {
"username": "neo4j",
"password": "hroads"
}
},
"token": "7aa51572c0f30da326f45d0078e4ecdd"
},
"resource_url": "http://localhost:7474/db/data/",
"resource_data": {
"extensions": {},
"node": "http://localhost:7474/db/data/node",
"node_index": "http://localhost:7474/db/data/index/node",
"relationship_index": "http://localhost:7474/db/data/index/relationship",
"extensions_info": "http://localhost:7474/db/data/ext",
"relationship_types": "http://localhost:7474/db/data/relationship/types",
"batch": "http://localhost:7474/db/data/batch",
"cypher": "http://localhost:7474/db/data/cypher",
"indexes": "http://localhost:7474/db/data/schema/index",
"constraints": "http://localhost:7474/db/data/schema/constraint",
"transaction": "http://localhost:7474/db/data/transaction",
"node_labels": "http://localhost:7474/db/data/labels",
"neo4j_version": "2.2.0-M02"
}
},
"response_hash": {
"extensions": {},
"metadata": {
"id": 2000,
"type": "LEAD_TO"
},
"data": {
"created_at": 1422832907
},
"property": "http://localhost:7474/db/data/relationship/2000/properties/{key}",
"start": "http://localhost:7474/db/data/node/1266",
"self": "http://localhost:7474/db/data/relationship/2000",
"end": "http://localhost:7474/db/data/node/1264",
"type": "LEAD_TO",
"properties": "http://localhost:7474/db/data/relationship/2000/properties",
"id": 2000
},
"rel_type": "LEAD_TO",
"props": {
"created_at": 1422832907
},
"start_node_neo_id": 1266,
"end_node_neo_id": 1264,
"id": 2000
}

Remove the certain properties of objects from the json document response Swagger for REST api

Hi I am using swagger for documentation of my RESTful web service. wanted to know is there any way to remove the certain properties of objects from the json document response? I mean there are lots of properties that swagger gives for my method param objects and response model (e.g. notes, defaultValue, allowableValue, internalDescription etc.) that are not required for me and are null due to that the response is not much readable
For method params:
"parameters": [
{
"name": "someName1",
"description": null,
"notes": null,
"paramType": "path",
"defaultValue": null,
"allowableValues": null,
"required": true,
"allowMultiple": false,
"paramAccess": null,
"internalDescription": null,
"wrapperName": null,
"dataType": "string",
"valueTypeInternal": null
},
{
"name": "someName2",
"description": null,
"notes": null,
"paramType": "query",
"defaultValue": null,
"allowableValues": null,
"required": true,
"allowMultiple": false,
"paramAccess": null,
"internalDescription": null,
"wrapperName": null,
"dataType": "string",
"valueTypeInternal": null
}
],
-=============================================================================
For response model classes
"SomeResponseClass": {
"required": false,
"name": null,
"id": "SomeResponseClass",
"properties": {
"instanceVariable1": {
"required": false,
"name": null,
"id": null,
"properties": null,
"allowableValues": null,
"description": null,
"notes": null,
"access": null,
"default": null,
"additionalProperties": null,
"items": null,
"uniqueItems": false,
"type": "Date"
},
"instanceVariable2": {
"required": false,
"name": null,
"id": null,
"properties": null,
"allowableValues": null,
"description": null,
"notes": null,
"access": null,
"default": null,
"additionalProperties": null,
"items": null,
"uniqueItems": false,
"type": "double"
}
}
your JSON mapper is not configured to ignore null properties. You can easily address this as follows:
#Provider
#Produces(MediaType.APPLICATION_JSON)
public class JacksonJsonProvider extends JacksonJaxbJsonProvider {
private static ObjectMapper commonMapper = null;
public JacksonJsonProvider() {
if(commonMapper == null){
ObjectMapper mapper = new ObjectMapper();
mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
mapper.setSerializationInclusion(JsonInclude.Include.NON_DEFAULT);
mapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false);
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
commonMapper = mapper;
}
super.setMapper(commonMapper);
}
}
Add this mapper to your scanning properties in the web.xml and the nulls will be gone.

Resources