REST API for Windows Azure Mobile Services - rest

One of the things I enjoy about Parse is the REST API which allows me to send push notifications to "channels" from an external website. I am curious if this, or something similar is available with Windows Azure Mobile Services.
From what I can see, the best way to achieve this result is to create a table which stores push notifications on the Azure Mobile Services. Override the onInsert node.js script to send a push when a record is inserted. The insert is coming through the existing REST API which does allow me to interact with the tablet itself.
What I would like is the ability to provide, for example, my iOS Device Token to the API along with various application access credentials to a REST endpoint and use Mobile Services to send the notification on my behalf, while keeping the information on those clients in my own database hosted in SQL Azure or another location.
Thanks for any insight.
Jason

Today this is posible by creating a "virtual" table in Mobile Services which you only use for the scripting layer. Instead of performing request.execute(), you'd just put in the code that calls push.APNS(or whichever platform you're pushing to) to push out to your client. You can use the mssql module to execute a stored procedure or custom sql on the connected database (which could then talk to a different SQL Database if you are storing the data separate from the DB connected to Mobile Services). As far as getting data to the service, just send over any data you need just like if you were going to insert the data into the table (so they will be fields on the ITEM parameter in the insert scripts) or use the optional PARAMETERS parameter when making a call against your MSTABLE object (and they'll be available on the REQUEST.PARAMETERS object in your scripts).

The API feature now can be used instead of the virtual tables. More detailed info in this question:
How to use the Azure Mobile Service API feature

Related

Microsoft Access APIs?

I've been digging through Microsoft's API pages (both the REST APIs and the Graph APIs) - but I'm having a hard time finding out if there is any way to access Microsoft Access through an API.
I'd like to be able to make an API call to get like the list of rows in a particular table or query for the list of tables altogether - or, on the flip side, add a row to an existing table. (Edit: I'd like to do this via REST calls and allow users to connect accounts so that many different people could access these things on their own). Does anyone know if this is possible? I'd super appreciate any links to any API docs or examples y'all have ^.^
For reference, I've been looking primarily at these two places:
https://learn.microsoft.com/en-us/graph/api/overview?view=graph-rest-1.0
https://learn.microsoft.com/en-us/office/client-developer/access/access-home
Access doesn't provide any functionality to directly access the data from a HTTP endpoint (REST API). It can only function as a database(backend) in this scenario and you would need to look into other solutions to get the data from the database and provide it from a HTTP endpoint (REST API).
If you're looking to use Microsoft technologies for this solution, then you can look into ASP.NET Core to provide the Web API functionality.
You'll need the Access Data Provider to be able to access data in a MS Access database, which as far as I know runs only on a Windows OS.

Google Assistant actions on google

All my hardware is already developed. I use MQTT for communication between my devices, I have lights, fans, heaters and many more ioT appliances. I can controll all of these from my Android application which i have built. I would like to use Google Assistant to control my devices as well. The status of my lights (on/off) are stored in a sql database and when ever a change occurs to the database(detected by the hardware) my hardware can control that specific light. In My Android app i do the same thing which is updating the databases value(on/off) of the light and the change is detected by my hardware platform. Can i use Google Assistant to update a sql database value?
I can create a webserver( ASP.NET C#) and pass the command to the sql database of my relevant customer if google assistant can invoke the username or email, lightID, command to my webserver. Can google assistant do this? If not how would achieve this.
It sounds like you want to take a look at the Actions on Google Smart Home API which will let the Assistants Smart Home controls work with your control server directly.
Without knowing exactly how your database or existing web server are configured or hosted, I can speak only broadly at best. Your web server will need to implement two primary things:
You'll need an OAuth2 server that can issue tokens that represent your users. This is how Google will associate the user's account on the Assistant with your account, and how Google will identify (to you) which user is issuing the command.
You will need to implement a webhook at a URL on your web server. This webhook will be sent a POST message containing a header with a valid auth token (that you issued) and a JSON body. The JSON will contain information about the command that has been issued by the user. Your HTTP reply body will also be JSON. For details of the JSON formats and all the fields that it can send and that you must reply with, consult Google's documentation.
There are a number of different commands (which Google calls "intents") that Google can send you on behalf of the user. You should be able to handle all of them by either querying or modifying your database:
SYNC - A request for what devices this user has, some of their configuration information, and what commands they respect.
QUERY - What is the current state of the devices for this user.
EXECUTE - Change the state on some of the user's devices.
RESYNC - (Future update) A re-request of the user's device info.

API call from post trigger of DocumentDB

I need to make an API call from post trigger of Azure DocumentDB.
I tried calling external APIs - but found that such calls are blocked in DocumentDB. If I host an API on Azure's same account will that API is allowed to be called from the post trigger ? If not what can be the alternatives.
Server-side code runs in a sandboxed environment and cannot make external calls. You can, instead, make the same call from your client after your request is acknowledged by the service (indicating your post-trigger succeeded/failed).
DocumentDB now supports a private preview of server side change feed. Using this model you can pull down all the changes from a DocumentDB collection and execute custom logic to perform desired post processing like invoking web services.
Please email askdocdb at Microsoft dot com if you want to learn more about this pattern.
In server-side scripts you can use all JavaScript functionality and CRUD/Query API for DocumentDB. Other "hosting" API is not exposed. For instance, JavaScript by itself doesn't have built-in support for file system or web API, functionality like needs to be provided by host (IE, cscript, etc). DocumentDB doesn't provide additional API other than CRUD/Query API.

Host my own user authentication service on my own server?

I have tried Google with queries similar to the title of this question, but haven't found anything useful.
Background: I am building a web app and would like to add a user authentication level to it. I cannot imagine anything worse than building a user authentication system from the ground up, so I want a quick solution.
I'm looking for open source software I can host on my server that provides an auth layer I can connect to, with multiple user accounts
Criteria:
I want to host the software on my own server
Provide a log in screen that works with multiple sign in strategies - twitter, facebook, vanilla email, etc.
Persists users to a database (preferably postgres) and persists session data
Preferably lets me store a minimal amount of data per user, like key value store
Has a client-side (Javascript) API, like Facebook's JS, so I can use this auth service on multiple sites. Namely, I want to use it on localhost or my own file system (when allowing file cookies). Client side JS API exposes methods like log in / log out
Has a server side API (such as exposes local RESTful endpoints) so that when I do build out my server side app for other data storage outside of the user, my app can query the auth service for log in status.
I want to run this stack completely independently of my own app - in fact I want to run this auth service and purely communicate to it from my local dev environment without building any server side app of my own.
I have used Firebase and they do many of the things that I want, including log in strategies and the client / server side APIs, but I want to be able to host my own version of this.
I can't imagine anyone takes pleasure out of building user authentication of any kind, so I'm surprised I haven't found anything in research.
I also know this is an open-ended question, but as far as I can tell I haven't found anything satisfying my requirements.
I like Devise (https://github.com/plataformatec/devise), which is for Rails. It has an active community with a boatloads of plugins available that can fulfill many of your requirements.
I didn't see a language specified; most languages and frameworks have their own implementations. Can you provide more information?
Example: I use the Flask framework on python. In addition, I use the Authomatic library which provides Oauth access for twitter, google, facebook, etc.
What I was looking for is something called a Single Sign On solution. According to this list there is nothing currently that meets my criteria.
Instead I have chosen to just run a local webserver and implement a regular auth flow.

Access SQL db from mobile app

I'm building a mobile front-end for my customer's CRM system. CRM data is stored in a SQL Server database in their local network. What will be the best practice to make this data available to mobile app users. Mobile app will be distributed using Enterprise key, not via App Store.
I'm thinking about making a WCF service running on a local server and having access to the SQL server via ethernet. This service will provide basic authentication. But I'm not sure if it's the best way in terms of security.
How to provide access to SQL server data?
A WCF web service can definitely be used as a SQL front end. Windows or JavaScript-based client applications running on hand-held devices have no trouble accessing WCF applications, and there's plenty of sample code out there about using a WCF app as a front-end to databases. Here's a sample project from CodeProject.
Security wise, there are several options: you could create a Login(ID, PWD) function that all non-authenticated user requests would have to pass through before getting to your SQL server. Once the user authenticates, you can create a persistant session or send back to the client a SessionID he/she can use to re-authenticate on subsequent requests. You can also use more exotic and complex methods for authentication/authorization like client certificates and Forms, though on a iOS or Android device that will certainly take some extra work.
Since a public web service, accessing company core data, is a hacker's dream, you can always set up your web service so that it can only be accessed from inside the company firewalls via VPN. If not that, then you can use SSL or message-level encryption.