API call from post trigger of DocumentDB - rest

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.

Related

how do I call salesforce APEX From rest api

I find tons of articles explaining how to call rest apis from APEX - but I'm accessing salesforce from an integration system using the Salesforce REST API, and want to it the other way around.
ie -
I've found functionality (record merging) - that is not available from the rest API, but IS available from apex. Is there any way to run an apex statement or script from the rest API?
NOTE: I'm aware that the functionality also available from the SOAP api, but we really don't want to go near that for various reasons.
you want to REST API endpoints in APEX, so that you can call this endpoint from anywhere, Right? if so then you need to check this article.
After reading above article, you are able to create GET, POST, DELETE endpoint in your Salesforce Org and you can use this endpoints.

REST API calls for setting namespace preferences and Program preferences

Can the namespace preferences and program preferences be set via REST API calls? If yes, what is the syntax for it?
Generally in Cloud Data Fusion, when we intend to perform the action on GCP side, like create/delete/restart etc. instance, it's feasible to use domestic Google Cloud API, giving the opportunity to interact with a service endpoint via JSON/HTTP calls interface as described in Google Cloud API design document.
Dedicated to Data Fusion you can follow the Cloud Data Fusion REST API reference document, nicely explaining the methods for composing REST API HTTP calls to manage Data Fusion instances, moreover every method description from the documentation contains Google API Explorer sub-panel, to get handy experience building JSON request on a live data.
Said above, I assume your initial question is related more to CDAP REST API, as it includes the methods for pure CDAP instance metadata/namespaces/application configuration.
From the user perspective your workflow might be the following:
Identify the CDAP API endpoint as explained in this guideline;
Compose an HTTP PUT/GET request relevant to Data Fusion
Namespace/Metadata/Preferences/Configuration
object via CDAP RESTful API.
Yes of course! You have two methods.
The first method is creating it from the platform. Follow the steps below:
Open your data fusion instance
Go to System Admin => Configuration => Make HTTP calls
To create a namespace, submit an HTTP PUT request:
PUT /v3/namespaces/<namespace-id>
Link of CDAP: CDAP
The second method is using terraform.

Azure Media Services Encoding Job Callback to URL

Using only the REST API, I am able to upload a file to Azure Media Services from my local machine and start an encoding job. Then I need to poll the job for status to see when it is done. But, what I really want is for Azure Media Services to send a request to my callback URL when it is done. Is there way to do this?
Take a look at our Notifications features which supports WebHooks.
https://learn.microsoft.com/en-us/azure/media-services/media-services-dotnet-check-job-progress-with-webhooks
It integrates well with Azure Functions also - if you want to host your callback in Azure Functions and just leverage the WebHook trigger in there.
We have some examples of doing that up here:
https://github.com/Azure-Samples/media-services-dotnet-functions-integration/tree/master/101-notify-webhooks

Consuming SalesForce REST API in VisualForce page

I would like to consume SalesForce API using JavaScript that running in VF page that already authenticated. Is it possible to do that without another authentication just to get the security token to call REST API?
What would be the alternative to call SalesForce REST service in valid VF page using JavaScript?
Have a look at the Visualforce Remote Objects. It is only in developer preview at the moment but will provide JavaScript proxy objects for DML operations.
Alternatively, you might be better served by JavaScript Remoting or exposing apex web services that you call from your Javascript.

REST API for Windows Azure Mobile Services

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