Is it possible to use the Alchemy API in Matlab? I want to call the URLGetTextSentiment method, without using other IDE's.
Would be great if you have some experience with that and share it with me.
AlchemyAPI provides REST API endpoints for all text-mining and content analysis functionality. You can call those REST APIs from wherever you need, once you know your API key. In Matlab you can interact with RESTful web services using webread and webwrite.
Related
A consulting client will provide a REST API and I need to connect to it through a locally installed on-premises Matlab (not Matlab Production Server), download and crunch some data and then send the results back.
I don't have experience with REST API yet so please excuse if I am mixing terms.
Right now I am trying to understand which is the relevant documentation for me and there are two options I am looking at:
The methods listed here - https://nl.mathworks.com/help/matlab/internet-file-access.html?s_tid=CRUX_lftnav , all relate to a RESTful Web Service. I don't know yet if the client has a REST API that can be categorized as a web service (I am going to use it to access some client data) - would anybody know what the 'standard' use case for a REST API is and if it will likely be considered as a 'web service'? I guess the 'web' service part refers to the HTTP protocol and it does need to be a website?
Then there is a bunch of documentation related specifically for the Matlab Production Server, which seems to me to be a more general version of dealing with REST APIs - https://nl.mathworks.com/help/mps/restful-api-and-json.html
However, if I understand it well, the second option is exclusive to MPS (and this is not what we will be using to access the API - we will be using standard Matlab Standalone desktop version)
Appreciate any help and clarifications!
p.s. I have read REST api vs REST Webservice vs RESTFul web service and that has cleared some questions on the difference between REST Api and REST API web service but it is still somewhat unclear in my head.
Sounds like you want to use webread and webwrite.
The MPS stuff is where MATLAB acts as the REST API, i.e. MATLAB is the server...
With webread and webwrite you can read/write data to/from an external server that's nothing to do with MATLAB.
When I hear API, I think the only way to use an API is to write a program to call the functions provided by the API.
Is writing a program the only way of using a RESTful API?
It seems that we can use curl to use RESTful API in https://developer.github.com/v3/guides/getting-started/. So how is that possible without writing a program to call the functions provided by a RESTful API?
Thanks.
There's no reason you can't invoke a RESTful API via a utility such as curl.
However, it only works for the simplest of use cases.
Most use cases have several steps that simply work better through automation. From creating or interpreting the payloads that are sent/received from the API calls, to orchestrating several calls in a larger transaction.
Also, consider, if you put your curl command in to a script file, then, well, that's "programming".
I am new to this powershell scripting and also to the IBM's softlayer. Can anyone provide me the exact guide for connecting to the softlayer using powershell scripts and working with them like creating devices, starting and stopping e.t.c.
Neeli, a good point of start is the following https://sldn.softlayer.com/article/Softlayer-API-Overview.
And currently SoftLayer API provides support for SOAP!, XML-RPC or REST protocols.
Besides SoftLayer API can be used many programming language that support the previous mentioned protocols, please review the following link https://sldn.softlayer.com/ to know more about each one of them and all the information about what IBM SoftLayer API provides.
Here you can see an example about how to use powershell and softlayer:
https://softlayer.github.io/tags/powershell/
The example is just performing REST calls to the Softlayer API, so you just need to know how to permor those REST calls.
In documentation you can see how to create a virtual guest or bare metal server using simple Rest calls:
http://sldn.softlayer.com/reference/services/SoftLayer_Hardware_server/createObject
http://sldn.softlayer.com/reference/services/SoftLayer_Hardware_server/createObject
In https://stackoverflow.com/questions/tagged/softlayer you can find many questions about how to use more Softlayer API methods. You just need to know how to do it using REST calls and just write that call to your powershell script.
I'm trying to use the Swagger UI, and it says that I should begin by writing an api-doc that describes the exact api for a REST api. The problem is that I have no idea what this means. Is this document written in plain English? Or is there a certain format that will be able to generate the UI?
Thank you!
Swagger is a specification for describing REST APIs. Documentation of the specification can be found here - https://github.com/swagger-api/swagger-spec.
Generally, there are two ways to document your API. If you already have an existing API with code, you can use any of the existing libraries (https://github.com/swagger-api/swagger-spec#additional-libraries) to integrate into your code and generate documentation at run time. Some of those libraries also offer offline generation of such docs.
If you're looking to design an API, or would rather not integrate another library into your application, you can use https://github.com/swagger-api/swagger-editor either locally or with the online version - http://editor.swagger.io.
Once you have the documentation, you can use Swagger UI to visualize and test it.
Like SOAP which as a WSDL which allows you generate code that will help create request, is there any mechanism in REST which allows you to document the payload or response of a REST API call?
Most services that provide REST APIs, seem to provide samples to explain the structure.
What is the best practice for REST APIs.
If you're returning xml, you can simply provide an xsd. There is also wadl, which some frameworks will generate automatically.
I find the best practice is providing samples (or links to samples) to explain the structure. Developers working against your API then need no extra tools or workflows to know how to interact with each part of your service.