Is it possible to consume Odoo inventory via the Web Service API? - odoo

Is it possible for an external application to update inventory items tracked within Odoo and mark them as shipped to a specific customer?
If so, what's the best way to do that? Via the XML-RPC web service API? Is there a REST API?
The XML-RPC web API seems to imply that this is possible, but it doesn't list the database entities upon which the API is allowed to act. Can this API act on any DB entity?
Thanks in advance for your time.

From what I've seen, there isn't a standing RESTful API for Odoo. There is an API for communicating with Odoo which can be found here. As well as tutorials on how to implement these features here.
If you are in need of a RESTful API then I would provision your own server and have it act as a reverse proxy which communicates through the RESTful model. This way you could dynamically connect multiple clients to multiple DB instances from one point. If you're comfortable with nodejs here is an npm module which just makes HTTP posts to the database with Remote Procedure Calls which have been JSON-ified. This combined with express would offer you a quick solution for an Odoo RESTful API.
That module, however, doesn't seem extensively maintained but the logic is relatively easy to follow and you could fabricate your own quickly.

You can try with the XML-RPC API of the object stock.quant
You will have to provide the location_id and request the product_id and quantity.

Related

How to add user interface design in microservice architecture

I'm building small vue.js microservice application and I have few doubts. Firstly I'm using mongoDB as my database, and I'm using express. After I want to use Docker and Kubernetes to deploy the application.
I want to use 5 microservices:
Basic publishing and product catalog
Commenting inside the post
Products can be added to cart
Paying the certain products after the cart
User authentification (login and register)
So the problem is how to add user interface design if the microservices which I want to use are backend based. How to exactly add the frontend if it can't be part of microservices. Or maybe should I use React and implement HTML/CSS things inside javascript code? Is it even possible because I want to use just MongoDB for every database needed in a microservice and write every microservice in Vue?
It's always upto you what you are good and requirement.
There is no specific best practice with microservices to follow certain languages together, people use the different languages in microservice like Ruby, Node, with React as front or one Python service managing the user auth.
It's depends on you what you are good with and familiar with.
You can create the Python app as a user interface or react or HTML which call backend services over API calls or grpc.
There is one example in the Istio repo : https://github.com/istio/istio/tree/master/samples/bookinfo
It's a book info app in Node, Ruby, Python using databases like MySQL, MongoDB etc.
https://cloud.google.com/service-mesh/docs/deploy-bookinfo
Update :
For Vue base, this blog and repo might be helpful vue-microfrontend
https://itnext.io/setup-a-micro-frontend-architecture-with-vue-and-single-spa-2c89528bf72f
Repo : https://github.com/vue-microfrontends

Create Azure Api App from Swagger meta data

I have created some APIs in API management layer, which are essentially proxies between the calling client and an underlying web api.
I did this by importing the swagger file of the underlying API, and then adding the newly created API to a Product, repeating this for each separate proxy that I needed. This means then that the underlying API could be called but not without the subscriber key of the product that the newly created API was attached to.
Is it possible to do something similar with API apps, i.e. creating API apps using just the swagger file from the underlying API in the azure portal, that act as proxies between the calling client and an underlying web api (as below)?
Do you mind expanding on why do you need to have API Apps acting as proxies?
I am not aware of such capability for API Apps specifically. There are Swagger-based code generation tools available, for example on http://swagger.io/open-source-integrations/. So perhaps you will be able to find something that would work for you.

How do I implement basic API gateway

I am working on one school project, And my task is to make a simple api gateway, which can placed between any of the 3rd party api and the end users, tha gateway can be used for defining usage limits of the api or to do some security analysis, I am totally new to this, I know the basic concept of API gateway, but don't know how do I implement it using JAVA.
Can anyone please give me some starting point where to start implementation of API gateway?
And what are the frameworks I should use and for what purpose?
Thanks,
Nixit Patel
In a nutshell, API gateway exposes public APIs, applies policies (authentication - typically via OAuth, throttling, adherence to the the defined API, caching, etc.) and then (if allowed) optionally applies transformation rules and forwards the call to the backend. Then, when the backend responds, gateway (after optionally applying transformation rules again) forwards the response to the original caller. Plus, there would typically be an API management solution around it providing subscriber portal, user management, analytics, etc.
So basically any web service framework would work as a quick DYI solution.
You can also use plugin model of an open-source load-balancer such as NGINX.
Or take an open-source API Gateway to learn from it - e.g. WSO2 API Manager (the easiest way to see it in action is the hosted version: WSO2 API Cloud)

RESTful API - Custom Application - C#, Java, php?

This is really basic.I want to implement a RESTful web API.
Now I know you can write custom applications and scripts to integrate with the API.
What I need to know:
In what languages can you write this API? C#, Java, php?
When building/programming a program that implements this API, is this the client and the software that issued the API the server? (eg. Dropbox would be the server and the custom app that integrates with the Dropbox API is the Client?
Thank you.
A REST API can be built in any programming language that allows you to handle HTTP requests (or can be attached to a Web server as a handler for requests). The two methods I've been using:
Stand-alone Windows service implementing a REST service using WCF
WEB server Apache + PHP
You are correct about the terminology. A program consuming a service is called the client, a program providing a service is called the server (while actually in the PHP approach, Apache would be the server as it is taking the request and having the script handle it).
Additional nitpicking: JQuery is not a language, but a framework to help you use some JavaScript features more easily.
On your comment Recap:
Close :-) The Client transfers JSON/XML/whatever to a server using HTTP requests. The Client can be written in any language that can perform HTTP requests.
On the server side, there needs to be some application that handles the HTTP requests (service), also written in any language, as long as it "speaks" HTTP.
The API is the definition of which operations are possible, for example, adding user accounts, getting the current time, etc. (this is what you define - what do you want your service to do?).
The JSON/XML/whatever that you transfer is the workload, the parameters for the API call. For example, if you want to add a new user to your system, the workload could be the new user name, the real name, the eMail address and some other details about the user. If the API call returns the current server time, you might not need any parameters at all, but you get back JSON/XML/whatever from the service.
The actual call being made is determined by the URL you call. For example, the URL for adding a user could be http://localhost/myrestservice/adduser and you'd perform a POST request against that URL with the required workload. For the time example, the URL could be http://localhost/myrestservice/getservertime and you'd perform a GET request against that URL.
I suggest that you read about how REST services actually work before you start, as I see some question marks on your face ;-)
Short:
API = available operations (=> URLs)
Parameters to API calls = JSON/XML/Plain Text/whatever
Client = calls the service through HTTP
Service = handles the calls, replies to client in response to HTTP requests
If you are a php programmer and familiar with Codeigniter framework then go here : Working with RESTful Services in CodeIgniter.
visit also : Rest Tutorial
First of all, you should begin with learning what is a RESTful API.
http://en.wikipedia.org/wiki/Representational_state_transfer
http://www.restapitutorial.com/
http://rest.elkstein.org/
In what languages can you write this API? C#, Java, php, jQuery?
You can write an API in any language. What can help is the framework you'd be using. JQuery is not a language, but a framework for integrating Javascript application in every web browser, so it won't help.
I'd advice you to use a microframework to write your first RESTful API, because they usually are easy to use and help focus on the important (bottle/flask in python, express in javascript, silex in php, spark in java or nina in C#)
When building/programming a program that implements this API, is this the client and the software that issued the API the server? (eg. Dropbox would be the server and the custom app that integrates with the Dropbox API is the Client?
You're right, the server is providing you the service, hence the API. The client is user to that API, and implementing it into something useful.
As most of the people stated already, you can do this in just about any language.
Might I suggest that you look into NodeJS? If so, check out Restify: http://mcavage.github.io/node-restify/
There's a nice community behind NodeJS and I think it's quite open to newcomers. Just try not to pick up bad habits from JavaScript pitfalls. If you're new to programming, I'd suggest reading some intro book.
good luck!

What online REST API workbenches are available?

When creating a site/script to be on the client end of a RESTful API, what tools are available to create a "workbench" to explore the API, examining headers and responses while working through the design? Preferably one(s) that allow you to enter a custom endpoint, and create sample requests to see the responses. I recall seeing one nice workbench before, but its name has escaped me.
Re-found the one I remembered: The Apigee Console is a great interface for playing around with an existing API or building your own.
Mashery's I/O Docs is an open source workbench that you can deploy yourself on a Node.js server with Redis for storage.
If you have the wadl file of the ReST Services, you can load it in SOAP UI and use it.
EditedAnother much simpler tool Rest Client