Does Microsoft provide a swagger file for Graph? - swagger

I've crawled though as much documentation as I can find but I'm unable to find a swagger file for https://graph.microsoft.io/
There appear to be a couple of variations on this API and I've seen references to the Office 365 Graph API and Azure Graph API but I believe that Microsoft Graph is that latest unified version and provides the features I'm after.
I'd like to use the with Microsoft Flow and I was surprised that it wasn't integrated as an API out of the box. To register a Custom API with Flow however you need to provide a swagger file, hence the question.

I found something to convert between OData XML metadata to swagger. https://github.com/akorchev/odata2openapi
The msgraph metadata for beta is at https://graph.microsoft.com/beta/$metadata.
For TypeScript, you would do something like this:
import { odata2openapi } from 'odata2openapi';
odata2openapi('https://graph.microsoft.com/beta/$metadata')
.then(swagger => console.log(JSON.stringify(swagger, null, 2)))
.catch(error => console.error(error))
UPDATE: I noticed there was an error when trying it. I believe because the code did not handle when EntityType node did not have any Properties nodes. I put in a pull request to fix that. https://github.com/akorchev/odata2openapi/pull/7

There is an Open API (an evolution of Swagger) preview service description available for Microsoft Graph at this GitHub repo (/beta and /v1):
https://github.com/microsoftgraph/microsoft-graph-openapi
Currently it does not cover everything in Graph API. In the future the Open API descriptions will be published as part of the Graph API in a similar way as the $metadata endpoint is today.
You can use the Open API Tools to create a C# client (or any other supported language) for it. Here is an example for generating the v1.0 and beta clients using their docker image:
docker run --rm -v ${PWD}:/local openapitools/openapi-generator-cli generate -i https://raw.githubusercontent.com/microsoftgraph/microsoft-graph-openapi/master/v1.0.json -g csharp -o /local/out/graphv1
docker run --rm -v ${PWD}:/local openapitools/openapi-generator-cli generate -i https://raw.githubusercontent.com/microsoftgraph/microsoft-graph-openapi/master/beta.json -g csharp -o /local/out/graphbeta

Related

Asp.net Core on Docker - Cannot access index.html or /swagger/v1/swagger.json

I have a Web API with ASP.NET Core, everything looks good to me by using Visual Studio on Mac, I can see the swagger generated, like this
Next, I want to have build my web api as a docker container, I have a dockerfile like this, a have a docker image built and I can start my project using this command
My API still working fine, but the issue I am asking for advices is why I cannot access the index.html any more, /swagger/v1/swagger.json neither, how to fix that?
If your API working well and the only thing you can't access is swagger, I'd suspect that you've got a condition in Startup.cs to run swagger only in Development. Example below. Remove this condition to get swagger in Production (You're running the container in Production)
if(env.IsDevelopment())
{
app.UseSwagger();
}

Mockoon Dockerize command gives error file too old?

So I'm trying to create a proof of consept of getting a Jenkins API from swagger, importing it into mockoon, and then dockerizing it to run as a service in a kubernetes cluster.
I downloaded the JSON from swagger and was able to import into the mockoon desktop application. I then exported it into a file. I downloaded the mockoon cli and then tried to run dockerize but I get the following error:
mockoon-cli dockerize -d jenkins-mockoon-api.json -o `./Dockerfile`
Error: This export file is too old and cannot be run with the CLI
Please re-export the data using a more recent version of the application
I tried re-exporting but no luck. I'm starting to think I'm over complicating it. I just want to be able to deploy a pod with mockoon with that API.
Thanks for the help!
I found the issue. When Exporting you have to specifically do it as a Mockoon environment JSON, not a Swagger or anything else. Not a very good error message though!

Host multiple plumber API on shiny-server

I have shiny-server installed on my server and I want to run multiple plumber APIs from it. I have also R studio server, but with it I can run only 1 at the same time.
Do you know a method to do this?
As far as I know it is not possible to run Plumber API's with shiny-server (and this ticket seems to confirm that.
You can however run multiple Plumber API's using RStudio Connect, and even scale the resources you allocate to your plumber API up or down depending on the need.
Given that RStudio Connect is a commercial product, it may not be a deplyment option for your (at this moment). You can, however, still host multiple Plumber API's on your server, but using Docker. The instructions are included in the Plumber documentation.

Zap scan is not running SOAP injection test

I am passing the 90019 scanner, for SOAP injection, into a zap script, but it is not running it, while it does run other rules, such as OS Command Injection, and SSI Server Side. I am running zap from a docker container and I noticed watching the output that these other rules correspond to a particular zap plugin. So, I am guessing I am missing a SOAP plugin in my environment and my question is: how can I install a plugin in Docker that corresponds to scanner 90019 to make sure that the script that runs zap scan checks for this rule? Many thanks. If there's something else that I am missing or more info is needed, please let me know.
The SOAP Scanner is included in this add-on: https://github.com/zaproxy/zap-extensions/wiki/HelpAddonsSoapSoap
This is included in the weekly docker image but not in the stable one.
You can install it when you start ZAP in the docker container by adding the parameters:
-addoninstall soap
You can also install add-ons using the ZAP API, but thats only worth doing if you are already using the API.

Example of reading and writing transoforms with PubSub using apache beam python sdk

I see examples here https://cloud.google.com/dataflow/model/pubsub-io#reading-with-pubsubio for Java, but when I look here https://github.com/apache/beam/blob/master/sdks/python/apache_beam/io/gcp/pubsub.py its says:
def reader(self):
raise NotImplementedError(
'PubSubSource is not supported in local execution.')
What does that mean? Cloud Data Flow Python SDK PubSub Source/Sink is not quite ready?
It means that reading from PubSub is currently not supported when executing the pipeline locally (on your machine, i.e. not in the cloud). Local execution is mainly used for testing.
PubSub is supported when you run using the Dataflow runner.
It would appear that it's not ready yet, as I was able to run it locally with the Java SDK and using the pubsub emulator, but as you've encountered, not with the Python SDK.
For anyone visiting this question in 2019, I can confirm that PubSub does work with DirectRunner as long as proper Google Cloud authentication is provided.

Resources