CosmosDB Rest API - Http Request - httprequest

Is it possible to retrieve my data in Azure Cosmos in JSON format and share it with someone else without them accessing the actual environment? Something like an HTTP get from sharepoint. I am new to cosmos and APIs, so sorry if I am using the wrong terms here.
Update Attempting Azure Function:
I attempted to create an HTTPTrigger. Can I copy and paste the JSON into function.json and javascript into index.js? I changed the databaseName and collectionName, but it doesn't return the cosmos documents.

General
I think the easiest way to offer someone access to a specified collection would be to create an Azure Function. From the docs:
Azure Functions allows you to run small pieces of code (called "functions") without worrying about application infrastructure. With Azure Functions, the cloud infrastructure provides all the up-to-date servers you need to keep your application running at scale.
A function is "triggered" by a specific type of event. Supported triggers include responding to changes in data, responding to messages, running on a schedule, or as the result of an HTTP request.
C#
Here's an example of how this might look if you want to query documents by id:
https://learn.microsoft.com/en-us/azure/azure-functions/functions-bindings-cosmosdb-v2-input?tabs=csharp#http-trigger-look-up-id-from-query-string
If you want more complex queries to be executed, take a look at this section of the abovementioned documentation:
https://learn.microsoft.com/en-us/azure/azure-functions/functions-bindings-cosmosdb-v2-input?tabs=csharp#http-trigger-look-up-id-from-route-data-using-sqlquery
So basically this enables you to provide a HTTP endpoint, that's configured to run specific query against your CosmosDB instance.
JavaScript
An example of how to set up a CosmosDB instance and create functions for CRUD operations in JS can be found here:
https://dev.to/vidamrr/cosmos-db-crud-operations-using-azure-functions-4d27

Related

Athena read-only request under the role with full access

We have .Net Core app that is actively using aws services and therefore has almost all permissions. It interacts with Athena via aws .net sdk and running pre-defined queries mostly, but there is one place in it where user can run his own query against Athena database and there is a theoretical possibility that he can run some malicious request like Drop Database and it will get executed, since the app has full access.
So the question is if there is a way to send read-only request from the app that has full access so that any request other than Select will automatically fail?
In sdk, there is an option to specify workgroup for request, and my idea was to create readonly workgroup with readonly permissions and send user request under it, but the problem here is that there is no way to assign Glue permissions bound to Athena workgroup, and therefore Alter Table requests for example are being executed just fine because app has a full access to Glue.
Parsing request with regexes sounds too complicated because it's rather hard to anticipate all sql injections possibilities, it's actually a separate big complicated task of implementing parsing engine and I have neither the time nor the wish to work on that.
Another idea was to create lambda just for this particular task, that solves the issue, but I don't like this solution, it's a really hacky and inconvenient way of doing this.
So I'm wondering if there is an adequate way of doing what I described? Thanks in advance.

Salesforce Org Metadata Retrieval Approaches

I am investigating different approaches to obtain select metadata (ALL objects - including custom - and ALL fields) for any org configuration, reliably. We will then use this information to build a .CSV.
My company works with the Net-Zero cloud and the NPSP. The metadata API does not have full coverage of all the objects and fields we require (https://developer.salesforce.com/docs/metadata-coverage/56).
We know this is possible, as the WORKBENCH REST API is able to retrieve the data we need, albeit on an object by object basis using REST API calls.
Approaches:
Build an APEX class that uses the schema class to retrieve all objects. Loop through objects, and retrieve all fields. Convert custom object into .CSV (either directly, or using a wrapper class to convert to JSON and then to .CSV).
Build a node.js server to perform REST API calls and then write the data to the local file system in .CSV format.
Parse the .XML directly from the Salesforce org. Any thoughts are welcome. We need this to be repeatable for any org configuration. Thankyou!

API Key use w/ Tableau

We would like to use the Podio API Key to directly connect to Tableau and have the data refreshed at a cadence set in Tableau. Is this possible?
Yes, connecting to data via an API is possible and there are a couple of ways to do it:
Option #1: Web Data Connector
A WDC is a hosted web application built with JavaScript that connects to an API, converts the data to a JSON format, and passes the data to Tableau. You'll require a webserver to host your WDC and JavaScript skills to write it. Once set up, anyone in your org can just grab the link and use it in Desktop. With WDCs, since the data connection is made when the end-user is requesting the WDC, you can build in customizations for your users. (Ex: users can add filter parameters or authenticate with their own user/pass to only get what they have access to). WDC connections are extracts and can be refreshed on Tableau Server and Online. If you're using Tableau Online you'll need to use Bridge to auto-refresh.
Option #2: Hyper API
The Hyper API allows you to create, modify, and update extract (.hyper) files that you can then publish to Tableau Server/Online on a regular cadence. It's available for Python, Java, .NET, and C++ so you will need skills in one of those languages. I suggest Python as we have the most samples for it. You'll also need a server where you can run the extract refresh and publish scripts on a schedule. With the Hyper API you are creating a single extract for everyone to connect to. Once published to Tableau Server/Online, end users can just connect to this data source directly without having to do any input but this also means the connection can't be customized per user or use case.
Option #3: Use a 3rd-party connector
If building your own connector doesn't appeal to you there are also plenty of services out there you can pay for that can bring your data into Tableau. Ex: tray.io, dataddo, and skyvia are a couple I found after a quick google search.

Apache Calcite - Access RESTFul Service with SQL

I have went through documentation and its a bit hard for me to grasp how one should go about writing adapter for anything. I want to ease the access of RESTful web services with SQL like interface for business folks.
Coarse requirements look something like:
Register data source, in this case endpoint
Add mapping for endpoint to table
Execute simple select queries
Allow joins to be performed on the basis of some join key but in client application memory
Represent the output in the tabular format
Try using Calcite's file adapter, which was just added in release 1.12.
The simplest use case is reading and parsing a CSV file from the file system, and presenting it as a table that can be used in a SQL statement. But in addition to files, the file adapter read documents via HTTP, and it can parse the contents of HTML tables. So you should be able to use it to read data from a REST service.

Is tableau able to access data dynamically?

Usually a Tableau dashboard operates on "static" data that are "attached" to the published dashboard. I wonder if it is possible to make Tableau able to read data on-the-fly (when a user interacts with it). By that I mean that the data, that should be visualized, are taken from a data base that can by "dynamic". It means, for example, that the data shown by Tableau today and yesterday should not be the same because content of the database might change. Alternatively, we might try to retrieve data from an API. For example Tableau sends a request to a HTTP server and gets a data table in form of JSON and than visualizes it. Is Tableau able to do that?
Yes, Tableau can connect to live data sources such as any number of database technologies. No, it cannot send HTTP requests for JSON directly. It does a have web data connection feature if you or someone has built that web service. Here are some tips on when to use Live connections versus taking an Extract. http://mindmajix.com/use-direct-connection-data-extract-tableau/