I am working on a prototype for using Smartsheets webhooks to notify an ASP.Net/WebApi endpoint when changes occur. While I understand the concepts, I have not been able to find a specific example of the structure that Smartsheets will be passing to the callback endpoint.
I suspect that it is a Json string and that I should be able to define a string parameter in the controller method to accept it like this:
public HttpStatusCodeResult Put([FromBody]string payload)
{ ... }
but I am not clear on what the parameter should be named (or even if it matters what it is named).
Can someone provide:
- An example of a Smartsheets webhook callback controller method
- Clarification on what the payload parameter type and name should be
I finally figured this one out. I used the Json response structure to create a similar class in C#, then used that structure as the incoming parameter type:
Controller code:
It is also possible to just use dynamic as the parameter type, but that doesn't take advantage of any compiler checks downstream so I opted for more structure by defining the classes.