How to call and read API REST with odoo 12 ( from my application to odoo) - rest

I created a REST API with my web application (PHP) and I want to manage this data with Odoo.
So, I want to create my own module on Odoo to read this REST API from my web application with odoo
( i want to display the result of my API on odoo not inverse ).
From My Application to odoo Not odoo to my application
Please guide me how to call and read the REST APIs with on Odoo.
Thank you

Related

public website with sapui5 and without credentials

I want to create public website(actually web page), with some inputs and send the data back to sap. My problem is that the website should be open for everyone and still be connected to sap(which requires username and password).
Is there a way to create sapui5 website without the need to give credentials(and still keep the sap system safe)?
If you do not mean to work with the user information/authentication which I assume is true because you do not want the user to log in, in that case, you can
Create a destination in SCP with basic authentication and store the username and password of the backend system you wish to communicate. An example to refer destination creation in SCP
Deploy the app in the SAP Cloud platform using the destination in your app to post the data.
Hope this should solve your problem.
Some more references:
how to set the authentication method to none in UI5 app in SAP Cloud Platform
How to deploy a simple UI5 app to SCP
Get a free trial account of SAP Cloud Platform

Web Service in Azure

I am trying to recreate a web service in Azure.
The web service needs to get data from an Azure database that needs to be exposed to SharePoint online.
The only options when I get when creating a web service in the azure Portal are as follows
Web App
Web App + SQL
Function App
Do I need to create a Function app instead?. Is a Function app equivalent to an On premise Web service.
It depends on what kind of web service you want to host in Azure. E. g. if you have a dotnet / dotnet Core REST API, you probably want to create an API App (just search for API App).

Retrieve logged user information from cloud foundry web application

We developed a web application using SAP Web-IDE Full Stack; we need to retrieve the details of the user logged into application (as defined in SAP Cloud Platform Identity Authentication Administration), for example display name and assigned groups.
We tried the userapi/currentUser API, but it seems to work only on NEO environment, for this reason is working fine while debugging in Web-IDE, but we get a 404 error when deploying the app on Cloud Foundry.
Do we need to add a new destination to make userapi work also on CF? Or is there some kind of similar solution available on Cloud Foundry?
I highly suggest using the SAP S/4HANA Cloud SDK for such tasks. It is an SDK developed to make building applications for SAP Cloud Platform easy, by providing easy to use mechanisms for all the Cloud Platform mechanisms.
Regarding your task at hand, there is a UserAccessor class that you can use like this:
final Optional<User> user = UserAccessor.getCurrentUser();
This works on Neo as well as on Cloud Foundry, i.e. there is a single interface for both platforms, which allows you to develop your app in a platform agnostic way.
If this sounds like it could solve your problem, I recommend checking out this blog post series to get started.
Alternatively, you can also simply add the following dependency to your project to start testing the SDK:
<dependency>
<groupId>com.sap.cloud.s4hana.cloudplatform</groupId>
<artifactId>scp-neo</artifactId>
<version>2.7.0</version>
</dependency>
For Cloud Foundry use scp-cf instead of scp-neo.
Hope this helps!
P.S.: To answer your question also on a technical level, Cloud Foundry uses so-called JWTs for authentication and authorization. You can check whether a JWT is present by looking at the Authorization header of the request. The JWT should hold the information you're looking for.
In SAP Cloud Foundry if you develop a MTA using XSUAA service to manage User Authentication and Admistration, defined for example in the mta.yaml,
...
resources:
- name: uaa_myapp
parameters:
path: ./xs-security.json
service-plan: application
service: xsuaa
type: org.cloudfoundry.managed-service
...
you can use the UAA API published from XSUAA service self to manage user authentication and authorization (e.g.: retrieve user info, groups assigned, password management etc..). also in the case the application is federated with another IDP.
To consume this API for example to retrieve user info you need to:
Determine the XSUAA endpoint bound to your app (SCP Cockpit > XSUAA service detail > take the value url)
Create a destination (xsuaa_api_destination) of type OAuth2TokenExchange bound to your app with url url took before, and fill OAuth2 authentication parameters with the data contained in XSUAA service detail (step 1).
From your app execute the call xsuaa_api_destination/userinfo, for example using an ajax if you are using JS.
You can find other info in Account and Authentication Service of the Cloud Foundry Environment SAP doc.

How consume REST service to expose it in oData

I have a REST service that I call from my client app. The service use JSON to manage data.
I want insert SAP NetWeaver Gateway between client and REST server to expose the REST data as oData.
The REST service have get and put methods to read and write data from/to db.
Now I have to decide the way in which starting:
Translate data from/to REST server using ABAP code to serialize data in the two ways (get REST data and create oData in response to a url get oData call and create the REST call in response to a url post oData call)
Use SMP - SAP Mobile Platform (Eclipse plugin) to write integration code (in javascript) to consume REST service in reading and writing exposing this service ad oData. http://scn.sap.com/community/developer-center/mobility-platform/blog/2015/04/08/integration-gateway-rest-data-source-overview-of-blogs
The 2nd solution seems to be the best way (no-require ABAP programming, use js high level language, parse-libs to manage oData and json ...) but i don't know if SMP was created to do this work.
And what is the result of the 2nd method? It seems to be a zip file (similar to a war) that I can push to the SAP Gateway to deploy the integration-logic. Right? How can I test my code without deploy every time the zip on SAP Gateway?
The recommended approach is to create a create Odata service in SAP Gateway and consume it in your app using SMP 3 or HCPms (SAP's mobile solution on cloud).
Use SMP SDK to consume the Odata service.

What are the best options to host an ASP.NET website, Java Restful webservice , MySQL Db and Web Crawler written in C# on Windows Azure?

I'm a student and we (the team) are trying to host our graduation project on Azure. We mainly have five components which are :
1- A crawler that crawls data from website and it is written in C#
2- MySQL Database that store data crawled and the interactions of users in the ASP.NET website.
3- Java Restful web service that process the data collected and crawled and send results to the websites.
4- In addition , the ASP.NET website that view the data processed by the webservice in addition to other data from the db.
What are the best option to host all these components on Windows Azure ? Should we use Azure Cloud Services and Website Service or just a normal Virtual machines ?!
We don't have much knowledge about Cloud so please if you could also provide us with some resources that help us deploying all these components , we would be appreciated. Thanks in advance :)
1- A crawler that crawls data from website and it is written in C#
R:Worker Role (Cloud Services)
2- MySQL Database that store data crawled and the interactions of users in the ASP.NET website.
R:Virtual Machine / Clear DB (MySql from Azure Store)
3- Java Restful web service that process the data collected and crawled and send results to the websites.
R:If you chose Virtual Machine for item 2, you can use the same VM for that.
4- In addition , the ASP.NET website that view the data processed by the webservice in addition to other data from the db.
R:Azure Web Sites / Web Role (Cloud Services) / The same VM of item 2 and 3.
If it's a simple web site, go with WAMS (windows azure web sites), if you need more control, go with web role.
More info about execution models, it will clarify each one:
http://www.windowsazure.com/en-us/documentation/articles/choose-web-site-cloud-service-vm/