Pushing/Posting data to a generic url via a webhook - c#

Im trying to work out how to send data via a webhook.
If data changes in the database then i will send json data to a specific URL via a webhook. How can this be implemented using c# / azure function trigger apps?
Example; If surname changes in the database then i want an instant response to send the data surname change via json to the the customers URL alerting them of this change.
Am i correct in thinking if i have a timer trigger app to poll the changes to then ping the data via a webhook, would this work and how would i go about using a webhook. Doesnt seem to be many c# examples of this way of working?
Maybe i need to see a working example / sample code.
Not sure if this would be the right solution currently.
Thanks in advance of any answers / general guidance.

Microsoft recently released Azure SQL trigger for Functions which will monitor a SQL table for changes and trigger an Azure Function when a row is created, updated, or deleted. As far as sending the data to a webhook goes you'll need to issue a HTTP POST request using HttpClient, see these MS docs: Make HTTP requests using IHttpClientFactory in ASP.NET Core

Related

Convert REST API to websocket client

I have existing C# web api, I want to convert it into websocket base API.
Where user can subscribe to the end point and then I can post data to user from some other service.
How can I implement this? Any guidlines will be great help.
I have tried doing it with websocket handler but it just send data by making call inside the controller method. I want to be able to push data from other service once the user subscribed to the websocket API end point.
ok, I created websoket hub and then added authorization on it where needed. Works fine as per what I wanted.
still if anyone has better solution, please suggest.

How to manipulate/scramble/encrypt JSON response from rest API

I have a web application built upon Angular 5 and asp.net. My use case is that I need a demo version of this application which must have same UI interface/ Front-end logic but the data/response coming through web api's should change(Data being very confidential so this demo version is intended not to show that data).
I have lots of routes and around 40-50 api's from where data is received. Now, how can I change or jumble all of this data so that original data is not shown to user.
Till now I tried solving it using Angular interceptor, that is to intercept each response and then changing JSON values to something vague. As far as I can understand, I need a layer which can handle all responses and change those response to dummy data. Is this the right approach or we should handle it at back-end using asp.net?

Sending data to Azure Events Hub from an external API REST

Like this topic : https://stackoverflow.com/questions/32843290/implementing-iot-powerbi-table-schema/32844087#32844087, I would like to retrieve data from an API REST to create a dashboard which will refresh in real time the data taken from the API.
In order to do that, I have to go through Azure Events Hubs to get the data taken from the API. I have troubles dealing with how to retrieve the data from the API to put it in the entry point of Azure Events Hub. I know I have to write a program (preferably by using Visual Studio) and make this program retrieve the data from the API and put it in the Event Hub but I have difficulties to see how I should begin. What kind of program and what I would need.
I tried to find some tutorial/codes about this but couldn't find anything about retrieving from external API.
From what I can understand, I need to write a program that connects to the Events Hub (not difficult), retrieve the data of the API, store it in a variable created and send it to Events Hub. I would like a bit help on how to start, where to start, what classes for example I would need etc...
I am not an expert on API at all, but I have some knowledge. For information this is the website from which I am trying to retrieve data from : https://data.sncf.com/api/en. The use of the API allows us to retrieve information in a json format if I am correct and I will have to save this data to store it in a variable ?
Thank you.
Per my understanding, I assumed that you could try to follow the steps below to achieve your purpose.
1.Use Azure WebJobs to call your API periodically, then send the data retrieved from the API to Azure EventHub;
You could follow this tutorial for getting started with WebJob by using VS. Also, you could follow this thread for making calls to a REST API via C#. For a simple way, you could leverage EventHub bindings supported by azure-webjobs-sdk to send messages to an event hub after you retrieved data from REST API.
2.For your client-side, you could follow the official tutorial to receive messages from EventHub via EventProcessorHost.

Set ItemSource/DataSource of an AutoCompleteBox in Windows Phone 8 to a database table created in PHPMyAdmin

Two parts to this question
So I've successfully got an AutoCompleteBox working with a local class file called Search.cs I followed this tutorial in order to do so using the IENumerable interface to bind the AutoCompleteBox to the "Search" class file.
Now I'm wondering, is it possible to do the same, except retrieve results from a table found in a Database in PHPMyAdmin on a hosted server? If so, how would I go about doing this?
How do you create get the Search Results to "Do Something", say if I wanted the search result to link to an external webpage via a basic hyperlink, or to another page in-app, what would I have to modify or add in? Any help is much appreciated.
phpMyAdmin is a tool to manage a MySQL database rather than a database itself, so you probably mean you want to connect to a hosted MySQL instance. This is possible, but what you probably want to do is write some server-side software that exposes an API rather that having full database access publicly available.
So then you'll have the server-side application waiting to be called. The Windows Phone application will fire off a request and wait for the response. The server application, when it gets that request, will do all the proper sanitizing of user-input data before running your query on the database and returning the properly-escaped results. How exactly you implement that API is up to your needs. Once the Windows Phone application gets back the response, it can build the page it displays to the user, which, yes, you can include hyperlinks. Make that part of the API response if you store the URL in the database.

Send Data Via Http In C#

I am creating Android Application for a school where teachers should be login to the android application and perform some activity on daily basis.
We have a complete existing web based solution for the same and now want to implement same in Android.
The application is developed in Asp.net and C#
To authenticate a user on android login, I have created a login API which takes username and password in the query string and in return the API return Json Data From That User.
example : www.yourdomain.com/authenticateuser.aspx?username=xxxx&pas=YYYYY
But I doubt whether its safe to send the data via query string.
Can anybody suggest a better possible way where it is not mandatory to send the data in Query String.
You can use Soap based web-service. I created a demo to consume Soap Web-service without KSoap Library.
Ref Link: SoapWithoutKSoap
You can use KSoap Library to create complex Soap Data Request.
I hope this can help you.
C# Web-Service: Demo and Demo1
UPDATE
Web Service Link will be something like this : http://123.456.789.012/Abhan/Abhan.asmx?op=JustTest (This is not working as I modified the IP Address)
In Browser, method name and passing parameter(s) information will be like something as attached image.
Thanks.
I'm using C# web services to autenticate users, send report data and get app updates.
You can get some exmaples in the web (C#):
http://msdn.microsoft.com/en-us/library/8wbhsy70%28v=vs.90%29.aspx
and ksoap2 for Android:
http://code.google.com/p/ksoap2-android/
But I also bought a SSL certificate to use https...

Categories

Resources