When working with an event that I am subscribed to, I receive 4 separate JSON responses, all of the same JSON format described in here
https://learn.microsoft.com/en-us/graph/api/resources/subscription?view=graph-rest-1.0
The only difference in these responses is the changeType. When creating an event, I get a response with changeType "created", and the other 3 responses are changeType "updated". What is the purpose/reasoning for the multiple responses with the same data?
Related
When any user creates a new team in MS Teams we want to propagate this information to our custom application and perform some actions. Is there any way to trigger this event ?
You can use Change notifications to receive webhooks to your own api endpoint.
To receive a webhook for a new event, you have to create a new subscription (See Create subscription) and use /users/{id}/events as resource. Change {id} to the Id of the user you want to subscribe to.
Because you only want to receive new events, set ChangeType to created. You can also use updated or deleted and to chain them, use ,.
Example request to create a new subscription
POST https://graph.microsoft.com/beta/subscriptions
Content-type: application/json
{
"changeType": "created",
"notificationUrl": "https://yourbackend.tld/api/new-event",
"resource": "/users/{id}/events",
"expirationDateTime":"2022-05-21T11:21:32.5261217Z",
}
expirationDateTime
Please be aware that the expirationDateTime has a maximum value. See Maximum length of subscription per resource type. The maximum value for events is 4230 minutes.
You can renew a subscription by extending its expiry time, see Update subscription.
Immutable identifiers for Outlook resources
I would also recommend to use the header Prefer: IdType="ImmutableId" to ensure that the Id of an event doesn't change over time. Read more about this here.
I can see that I can route one request to a responder and that there's different implementations like fireAndForget and all that but I have a case where producers are responsible for their subset of data. Specifically, the producers are actually just Kafka Consumers who are assigned a unique set of partition of the overall topic.
Is there a way to basically route the request to all these producers, and let the producer decide if they have something to send in response or not? A "findAllUsers()" request would need data from all of them, so all of them would need to contribute a portion of the response. Is this possible with Rsocket or does it only support 1:1 connections?
Only peer to peer. I guess you want this.
// Create connections to all producers.
Flux<RSocket> rSockets = Flux.from(...)
Request request = ...
// Merge all results from producers.
Flux.merge(rSockets.flatMap(r -> r.requestStream(DefaultPayload.create(request...))))
.subscribe();
I want to obtain a single value from a web service in JSON, just a file name i.e. "picture.png"; based on some parameters passed.
Can IOS (I guess NSJSONSerialization JSONObjectWithData:) handle this single value in JSON or on the server side should I have it send a dictionary key as in {"pic": "picture.gif"}
If there is no picture, I am returning "nopic" so again should I have it return "error" or {"error": "nopic"}
I gather the various JSON specifications are conflicting on this point so my interest is just practical...how best to handle this case.
Thanks for any guidance on this
I am currently creating an MVC application that is currently getting a value from a post from a webhook. I think that the problem is that the application is getting the value from the POST verb but then it is not displaying it because the Get verb is being used to display the View so both Verbs are counter acting each other.
The webhook will fire A Json payload to my application successfully because I have code in it that will send the Json payload in a variable via email to my email account.
Dim body = issue.issue.key
mail.Body = body
That is in a try catch block because in order for it to have a value it must have a value in it and the application will perform the GET first, so there is a null value in the body variable, then it does the POST to get the value but it will not display the value, refreshing will just perform the GET preventing it from being displayed. How can I perform both actions at the same time so I can display a value in a ViewBag for example.
ViewBag.response = status + key
This is the type of structure that I would like to implement to try and fix the error but I do not know how to complete all of the steps:
This is what I have got so far:
The POST is coming in from a webhook and I am reading it like this.
Dim reader As System.IO.StreamReader = New System.IO.StreamReader(HttpContext.Request.InputStream)
Dim rawSendGridJSON As String = reader.ReadToEnd()
Dim tempVar As Rootobject = JsonConvert.DeserializeObject(Of Rootobject)(rawSendGridJSON)
System.Diagnostics.Trace.TraceError(rawSendGridJSON)
I am then trying to store the post values in a table like this:
Public Function CallBack(tempTable as temporaryTable)
Dim tempVar As Rootobject = JsonConvert.DeserializeObject(Of Rootobject)(rawSendGridJSON)
tempVar = temporaryTable.tempVar
I then save the new items in the actual table in the database, then I try to display it in a view on another page. This is not working correctly and the problem lies with this line, as the post is not being correctly read in at the right time. (The value is processing correctly as I can use an email method to send the variables in an email back to the application but this application needs to be real-time efficient code).
Is there a better way to use this method and how can I invoke this process that I want to do properly so that I can display the correct information?
Update
To clarify, there are two posts that are happening, the first one is when the user enters in information and submits it. This is then stored in a database and send to JIRA via email. Once JIRA receives the information, it is sends a HTTP POST webhook JSON Payload back to my application with updated information. I then have deserialized the JSON Payload into a variable called issueKey.
The problem is that on the View page that the information is sent to will automatically display a null value first before the value is sent to it, I want the application to work so that it will actually display/store in a database the values from the Webhook JSON Payload but I cannot figure out how to display the values.
I have now set up a communication channel from SignalR to my MVC application, at the moment it is being received by the MVC and I have set up a SignalR chat Hub in my MVC application, but I don't know how to integrate them, how can this be done?
As I understand it, there are two flows at work here. The user posts data, which triggers an email to Jira. Then sometime later (usually quite fast, but not always) JIRA triggers a webhook in the web application with some updated information, and you want to display this updated information to the user somehow, or at least inform the user when the updated information comes back from JIRA.
I would implement a standard Post-Redirect-Get for the user initiated part (as per br4d's comment). I.e. a post to store the data in the database and send email to jira, which returns a redirect to a get which shows the data stored in the database.
Now for the other part I would use signalr to set up some sort of communications channel to the user. The webook could then send a signal (of sorts) through the communication channel to the users browser and either display the data, or trigger a refresh of the page (if you are updating the database with data from Jira).
It is unclear if you are doing straigt mvc, or some sort of SPA application, but it is not really important. The users browser has no way of knowing about the webhook (which is a part of the webapplication and unrelated to the users session), and you need some sort of communication between the webapplication and the browser, and for this signalr is very very good.
Suppose I have an Ext.grid.Panel containing a list of users. After some update operations I send the batch of modified records to a remote database :
[{"id":1,"login":"Jack"},{"id":2,"login":"Jack"}] // request body
At the server side, I store one record after the other in the database. Knowing that login name must be unique, the second record is not stored because "Jack" is no longer available. Then, I have to notify the user that he made a mistake marking the related grid cell dirty. Is there a way to let ExtJS handle that? A flag in the JSON response for example?
Update
Sometimes I need even more precision, marking invalid only one field of a single record. As an example, suppose I want to update two fields of a single record, "login" and "favorite" :
[{"id":1,"login":"Jack","favorite":true}] // request body
Both fields are sent together to the same URL then processed separatly via two different SQL queries, but saving "login" succeed while saving "favorite" fails. Is ExtJS able to treat each field separatly from a single JSON response?
Update
Ultimately, the main question is : what are the best practices about connecting the ExtJS 4 data package with a server side CRUD API ?
Could you share your own experience on these related topics : server side CRUD architecture, request body versus HTTP POST parameters, batch of records versus single record, error handling and JSON response... ?
Here is my own working environment :
ASP.NET 3.5
ExtJS 4.1.1a
Ext.data.proxy.Ajax
I have found an interesting resource : http://mvc.ext.net/#/GridPanel_Update/Batch. At first glance, it seems that they have implemented their own communication logic between client and server, bypassing the proxy features provided by the framework. It's hard to investigate deeper because the source code is currently unavailable. Here is an example :
Request data (HTTP POST) :
data: {
"Updated": [{
"Id": 1,
"Email": "fred#flintstone.com",
"First": "Fred",
"Last": "Flintstone"
}],
"Created": [{
"Email": "test#test.com",
"First": "f",
"Last": "l",
"PhantomId": "ext-record-1"
}]
}
Response data :
{script:"var _m0 = App.Store1.getByInternalId(\"ext-record-1\");_m0.setId(8);_m0.commit();App.Store1.getById(1).commit();"}