Odoo Webservices in PHP using XMLRPC - php

I am using the Odoo web services in PHP via XMLRPC.
It is working well and showing up the data, however I want to decrease my workload using the (Odoo ACL) access rights to show and hide the data for different type of the users based on the role.
Is it possible to show the data based upon the user roles? If possible please give me the snippet of the code to do this. I just want to use the XMLRPC not the RIPCORD Library because whole my code is already worked and i use the XMLRPC for this.

Related

What is the best way to achive realtime info on my website currently using php yii framework and django-rest for api with mysql

Here i have no idea, what to exactly use to get the real-time information on the web page on my already developed application. The real-time feature will be based on online Auction feature, as a bidder bids low/high amount all the concerned user should reflect the newer price on their window immediately without refreshing the web page.
Please suggest me the best way possible, my application based on:
PHP 5 frontend with yii 1.1.15 framework
Python django-rest framework for the rest api to fetch data from mysql database.
for this i have heard about the node js, but will it be possible using only node js without using mongodb/rethinkdb angular or express js or socket.io.
Why do you need bout Yii and Python? DRF is very easy to use and will provide the backend to provide a rest API and the front end can be something as simple as HTML/CSS/js to fetch data from the REST API. Yii will not add any value to this system.
You need to read up on how an API based system works works (which is what you are trying to do.

Web services to interact between Joomla backend and iOS/Android app

We just started to develop an app where we need to get some data from a Joomla backend. (Data would be company profiles. Those companies register on the Joomla webiste and the public information gets displayed in our app).
What is the best way to communicate between the app and the Joomla backend? The information from the database just has to be pulled once at the start of the app and maybe by manual refreshing.
So far I have read about REST API and SOAP as web-services. I played a bit around with examples from the internet but wasn't really successful yet. So could one of you give a simple explanation and a small example for the interaction between Joomla backend and an Android app e.g.
If you are looking for a pre-packaged solution to turn Joomla 3.5/3.6 into a Mobile Back-end as a Service (MBaSS) you may want to explore cAPI Core REST API.
https://extensions.joomla.org/extensions/extension/capi-core-rest-api
Please note that this is a commercial plugin which I developed. If you are OK with that, you may read on here for more information from a previously answered question:
https://stackoverflow.com/a/32706378/5361267
API Documentation can be found here:
http://learn.getcapi.org
Swagger UI Docs:
https://demo1.getcapi.io/api-docs
To answer your specific question about profiles, this extension will allow you to read and update profile data associated with any user. In addition to the built-in profile fields, the profile creation methods allow you to create and populate unique profile keys. While these might not be visible in the joomla interface (because they have to be defined in XML as well), they can be queried / updated remotely as needed.
PUT /user/profile/{id}
https://demo1.getcapi.io/api-docs#!/User/putUserProfileById

Laravel 5 website and API using the same app

The application I am migrating into Laravel 5 is a website and its API.
The API is used for the mobile apps and for the website to pull the data.
The website will not be developed to be a Single Page App, because I already have all the views and I'm just migrating the website to Laravel 5.
How can I do the following without duplicating my code?
For instance, allow /products to list all my products using this API endpoint (/api/2.0/products).
The same applies to all other routes
Yes you can. I am currently doing this myself. Writing the base API first and then dogfooding it for my own website. There is a good laravel package called Dingo ( https://github.com/dingo/api ) that can give different output depending on where you call it from.
If you call it simply from api.yourwebsite.com/products you will get JSON. but if you call it internally like API::get('/products') you will get array/object whatever you're returning instead.
So I have a website that is using the API to render itself. This way, you only write the API once, and can use it for your frontend website, mobile, or give it to third party developers too.
I hope this answers your question. If you have any more questions, please let me know. Thanks
You can do it by creating repositories for your code.
Then create separate controllers for both APIs and Website. Through that your code doesn't duplicated and you can access that repository from both the controllers and return response accordingly.

How do I programatically search Google Plus for posts via the PHP library

I'm trying to get my head around how to use Google's PHP library to search Google Plus using the API. I want to create a command line script that can be run regularly (cron job) to search Google Plus for a key word and then store the results in a database. I will then have a website (moderation tool) that pulls the posts from the DB and allows the moderator to reply to the original poster (or not and delete's that post from the DB).
I can do this with curl on the public API but it feels dirty. I want to use their API properly with OAuth2 but that involves a website for authentication. I want to run it via a cron job php script at the command line.
Can this be done?
Keep in mind that, although you can use OAuth2 to authenticate against the Google+ API, you don't really get anything from doing so. The only thing you can get right now are public posts.
So what you're doing is fine. If you still want to use PHP for some reason, you can take a look at https://developers.google.com/+/api/latest/activities/search#examples and select "PHP" in the pull down to see some example PHP code. If you're having trouble with this, post a question with details about what you've tried and what problems you're having with it.

how to login to another site via PHP

I wanted to find out how to login to another site via PHP... I don't know the proper term for it, but basically, I want a user to be able to enter their login information for another website on mine, and interact with it through mine.Is there any tutorial?
thanks
There are few ways to do the job (actually, you just need to send POST data to the other site).
You can use :
curl (example: http://davidwalsh.name/execute-http-post-php-curl),
stream context (example: http://php.net/manual/en/function.stream-context-create.php),
or directly with sockets (example: http://www.jonasjohn.de/snippets/php/post-request.htm).
curl will do that PHP, cURL post to login to WordPress
but you will need that installed on the server which is sometimes not an option. There is however loads of scripts that can do the same thing as curl without the curl libs installed, eg: cakephp's HttpSocket class
as already stated, Curl will do that.
But you can also check out this PHP Class that makes everything easier and gives you a lot of automation out of the Box
Including Prefilling of CSRF Token, finding of all input fields, retrieving of details from the designated site. etc
the class can be found Here. Crawl Engine

Categories