Home
%3CLINGO-SUB%20id%3D%22lingo-sub-385534%22%20slang%3D%22en-US%22%3EUsing%20R%20to%20generate%20API%20Client%20from%20Swagger%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-385534%22%20slang%3D%22en-US%22%3E%0A%20%26lt%3Bmeta%20http-equiv%3D%22Content-Type%22%20content%3D%22text%2Fhtml%3B%20charset%3DUTF-8%22%20%2F%26gt%3B%3CSTRONG%3EFirst%20published%20on%20MSDN%20on%20Jul%2020%2C%202017%20%3C%2FSTRONG%3E%20%3CBR%20%2F%3E%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fr-server%2Fwhat-is-operationalization%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3E%20Microsoft%20R%20Server%E2%80%99s%20operationalization%20%3C%2FA%3E%20feature%20enables%20data%20scientists%20to%20deploy%20and%20consume%20web%20services%20to%20operationalize%20their%20R%20analytics.%20The%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fr-server%2Fr-reference%2Fmrsdeploy%2Fpublishservice%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3E%20publishService()%20%3C%2FA%3E%20function%20in%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fr-server%2Fr-reference%2Fmrsdeploy%2Fmrsdeploy-package%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3E%20mrsdeploy%20%3C%2FA%3E%20package%20can%20be%20used%20to%20publish%20an%20R%20code%20block%20as%20a%20new%20web%20service.%20After%20it%20has%20been%20deployed%2C%20the%20web%20service%20can%20be%3A%20%3CBR%20%2F%3E%3CUL%3E%3CBR%20%2F%3E%3CLI%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fr-server%2Foperationalize%2Fhow-to-consume-web-service-interact-in-r%23data-scientists-share%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3EConsumed%20directly%20in%20R%20by%20another%20data%20scientist%20%3C%2FA%3E%20%2C%20for%20testing%20purposes%20for%20example%3C%2FLI%3E%3CBR%20%2F%3E%3CLI%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fr-server%2Foperationalize%2Fhow-to-build-api-clients-from-swagger-for-app-integration%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3EIntegrated%20into%20an%20application%20by%20an%20application%20developer%20%3C%2FA%3E%20using%20the%20Swagger-based%20JSON%20file%20produced%20when%20the%20web%20service%20was%20published.%3C%2FLI%3E%3CBR%20%2F%3E%3C%2FUL%3E%3CBR%20%2F%3E%20There%20are%20several%20tools%20like%20%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2FAzure%2Fautorest%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3E%20Azure%20AutoRest%20%3C%2FA%3E%20%2C%20%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2Fswagger-api%2Fswagger-codegen%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3E%20Swagger%20Codegen%20%3C%2FA%3E%20%2C%20%3CA%20href%3D%22https%3A%2F%2Fswagger.io%2F%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3E%20Swagger.io%20%3C%2FA%3E%20which%20can%20be%20used%20to%20generate%20API%20client%20library%20from%20swagger.json%20file%20in%20your%20preferred%20programming%20language.%20Now%2C%20we%20will%20look%20into%26nbsp%3Bgenerating%20API%20client%20library%20in%20R%20using%20the%20%3CA%20href%3D%22https%3A%2F%2Fcran.r-project.org%2Fweb%2Fpackages%2Fhttr%2Fhttr.pdf%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3E%20httr%20%3C%2FA%3E%20package.%20%3CSTRONG%3EUsing%20the%20below%20R%20code%20snippet%2C%20data%20scientists%2Fapplication%20developers%20can%20quickly%20generate%20API%20Client%20Library%20in%20over%2040%20different%20languages%20immediately%20after%20publishing%20the%20web%20service%20in%20their%20R%20session%20%3C%2FSTRONG%3E%20.%20This%20method%20requires%20no%20extra%20setup%2C%20no%20software%20download%2Finstallation.%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20After%20running%20the%20above%20code%20snippet%2C%20you%20will%20find%20the%20client%20library%20in%20a%20zip%20file%20in%20current%20working%20directory.%20Unzip%20the%20file%2C%20add%20nuget%20package%20dependencies%2C%20add%20authentication%20workflow%2C%20add%20client%20code%20and%20begin%20consuming%20the%20APIs.%20Here%20is%20a%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fr-server%2Foperationalize%2Fhow-to-build-api-clients-from-swagger-for-app-integration%23example-service-consumption-client-library-from-swagger-in-csharp%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3E%20detailed%20article%20%3C%2FA%3E%20.%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20To%20generate%20Client%20Library%20in%20your%20preferred%20language%2C%20just%20replace%20the%20language%20in%20httr%3A%3APOST%20URL%20%3CA%20href%3D%22http%3A%2F%2Fgenerator.swagger.io%2Fapi%2Fgen%2Fclients%2F%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttp%3A%2F%2Fgenerator.swagger.io%2Fapi%2Fgen%2Fclients%2F%3C%2FA%3E%20%3CEM%3E%20%3CSTRONG%3E%20%3CLANGUAGE%3E%20%3C%2FLANGUAGE%3E%3C%2FSTRONG%3E%20%3C%2FEM%3E%20with%20one%20of%20the%20supported%20languages%3A%20%3CBR%20%2F%3E%20akka-scala%2C%20android%2C%20apex%2C%20async-scala%2C%20bash%2C%20clojure%2C%20cpprest%2C%20csharp%2C%20CsharpDotNet2%2C%20cwiki%2C%20dart%2C%20%3CBR%20%2F%3E%20dynamic-html%2C%20eiffel%2C%20elixirperl%2C%20flash%2C%20go%2C%20groovy%2C%20html%2C%20html2%2C%20java%2C%20javascript%2C%20javascript-closure-angular%2C%20%3CBR%20%2F%3E%20jaxrs-cxf-client%2C%20jmeter%2C%20kotlin%2C%20objc%2C%20perl%2C%20php%2C%20powershell%2C%20python%2C%20qt5cpp%2C%20ruby%2C%20scala%2C%20swagger%2C%20%3CBR%20%2F%3E%20swagger-yaml%2C%20swift%2C%20swift3%2C%20swift4%2C%20tizen%2C%20typescript-angular%2C%20typescript-angular2%2C%20typescript-fetch%2C%20%3CBR%20%2F%3E%20typescript-jquery%2C%20typescript-node%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20The%20list%20of%20supported%20languages%20can%20be%20viewed%20%3CA%20href%3D%22http%3A%2F%2Fgenerator.swagger.io%2Fapi%2Fgen%2Fclients%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3E%20here%20%3C%2FA%3E%20.%3C%2FLINGO-BODY%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-385534%22%20slang%3D%22en-US%22%3EFirst%20published%20on%20MSDN%20on%20Jul%2020%2C%202017%20Microsoft%20R%20Server%E2%80%99s%20operationalization%20feature%20enables%20data%20scientists%20to%20deploy%20and%20consume%20web%20services%20to%20operationalize%20their%20R%20analytics.%3C%2FLINGO-TEASER%3E%3CLINGO-LABS%20id%3D%22lingo-labs-385534%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3ESQLServerMachineLearning%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Microsoft
First published on MSDN on Jul 20, 2017
Microsoft R Server’s operationalization feature enables data scientists to deploy and consume web services to operationalize their R analytics. The publishService() function in mrsdeploy package can be used to publish an R code block as a new web service. After it has been deployed, the web service can be:

There are several tools like Azure AutoRest , Swagger Codegen , Swagger.io which can be used to generate API client library from swagger.json file in your preferred programming language. Now, we will look into generating API client library in R using the httr package. Using the below R code snippet, data scientists/application developers can quickly generate API Client Library in over 40 different languages immediately after publishing the web service in their R session . This method requires no extra setup, no software download/installation.



After running the above code snippet, you will find the client library in a zip file in current working directory. Unzip the file, add nuget package dependencies, add authentication workflow, add client code and begin consuming the APIs. Here is a detailed article .

To generate Client Library in your preferred language, just replace the language in httr::POST URL http://generator.swagger.io/api/gen/clients/ <language> with one of the supported languages:
akka-scala, android, apex, async-scala, bash, clojure, cpprest, csharp, CsharpDotNet2, cwiki, dart,
dynamic-html, eiffel, elixirperl, flash, go, groovy, html, html2, java, javascript, javascript-closure-angular,
jaxrs-cxf-client, jmeter, kotlin, objc, perl, php, powershell, python, qt5cpp, ruby, scala, swagger,
swagger-yaml, swift, swift3, swift4, tizen, typescript-angular, typescript-angular2, typescript-fetch,
typescript-jquery, typescript-node

The list of supported languages can be viewed here .