ezpublis 5.x public api to get current user draft - ezpublish

In legacy stack there was a function to fetch current users drafts.
https://doc.ez.no/eZ-Publish/Technical-manual/4.x/Reference/Modules/content/Fetch-functions/draft_version_list
In ezpublish 5.x there is a similar method in rest api loadUserDrafts($userId).
eZ\Publish\Core\REST\Server\Controller\User.php
I want similar function for Public API. Is it available?

you can find this function within the content.service of the repository.
The method you are looking for is loadContentDrafts which takes a User as the first parameter and returns the drafts assigned to this user.
Hope this is what you are looking for.

Related

How to read a Google People api response object [updated]

I'm new to Google's API and I'm having trouble reading the content of a People contact.
To get the details of a particular contact, references show this code should work [Edit: I updated the personfields]:
profile = service.people().get(resourceName='people/c63810788897573286', personFields='names')
The resourceName is the ID of a particular contact (that ID will only work for someone with access to my account). The server grabs it correctly and returns this:
<googleapiclient.discovery.Resource object at 0x10fd183c8>
How do I read the content of this object? I can't figure out from the documentation
I want to print out the Name. I'm pretty new to APIs, so maybe there is a standard way to read an HTTP object or maybe it's something unique to Google's API. Thanks for any advice
I found an answer in another somewhat related StackOverflow. I needed to the add .execute() to the call
profile = service.people().get(resourceName='people/c63810788897573286', personFields='names').execute()

Spring Boot - Can A Web Application Use Its Own Rest Api

So I'm new to Spring Boot and am trying to get my head around how it works. But I can't find some of the answers I'm looking for online so was hoping somebody might be able to help me out.
My first question is, can a web application use its own rest api to
manipulate data eg. get, post, put etc. or is the api just limited
to use by other applications/websites etc. If this is the case how does a a web
application manipulate it's data does it just use a seperate
conventional controller?
My second question is, let's say I've a piece of code like this
#GetMapping("/responsebody")
#ResponseBody
public UserAccount testingResponseBody(Principal principal) {
if(principal != null) {
UserAccount currentUser = userRepo.findByUserName(principal.getName());
return currentUser;
}else {
return null;
}
}
A simple piece of code that returns a JSON for the currentUser. The
thing that has me a little confused is why would someone want the
current user JSON to be visible at the corresponding URL i.e
localhost:8080/responsebody. I mean lets say the controller is accessed by an AJAX request. The data is only needed internally in the
application. Why display it to the world at that URL. I feel like I'm missing something important. Is there a way to make certain controller methods only usable within the application to manipulate data without showing it at a URL.
Also if anyone knows of any really good resources where I can get
these concepts to sink in it would be greatly appreciated.
Thanks guys, hope I didn't make it too long.
I think that if you expose path then every apps can access to that path. If you want to use internal, you can restrict that path using security for example like "only apps that have authority 'INTERNAL_CLIENT' should only be access to that path"

Laravel 7 Api incomplete?

I started with Laravel 7 a few weeks ago. It happened to me multiple times that after reading about a topic on the Laravel website, I wanted to check the details of a function, for example:
Illuminate\Support\Facades\Route::group()
So I went to the Laravel API, and could find the Route facade, but not the group function.
What am I doing wrong? Where do you check for example the exact signature of a function?
Thanks!
The method group in Route::group() is inherited from another class, RegistrarGroup.
See the docblock method in the source file, vendor/laravel/framework/src/Illuminate/Support/Facades/Route.php:
#method static \Illuminate\Routing\Router|\Illuminate\Routing\RouteRegistrar group(\Closure|string|array $attributes, \Closure|string $routes)
so, this is what you look for in the API documentation:
https://laravel.com/api/7.x/Illuminate/Contracts/Routing/Registrar.html#method_group
That is because a Facade, by definition, is only an 'interface' to the methods exponed by another object, so you will not find the actual methods available by visiting the facade code.
Usually you can find the actual class that a facade resolves to (when not mocked) by checking the docblock in the source code and navigate to that class.
A very useful tool to overcome this problem and provide autocompletion (and inspection) for facades on your IDE is the package https://github.com/barryvdh/laravel-ide-helper

Google+ Sign-in API shutdown - Profile.me

since Google announced that Google+ Sign-in will be fully deprecated in near future, I just want to confirm that I understand we are not using any of its deprecated features.
Currently in our code I can see that we are only using following two classes:
com.google.api.services.oauth2.Oauth2
com.google.api.services.oauth2.model.Userinfoplus
Under 1, part of the code we are worried about is
public class Me
which, as far as I understand, addresses plus.me (https://developers.google.com/identity/sign-in/web/quick-migration-guide), which is being deprecated.
Under 2, is this class also being deprecated? It seems like the part (or all) of the Google+ profile is contained in there.
Both classes mentioned above are part of the following library version:
com.google.apis:google-api-services-oauth2:v2-rev77-1.19.0
The version of api-client is:
com.google.api-client:google-api-client:1.19.0
Many thnx
The Me class does not appear to be related to the plus.get endpoint. The Path specified in the Me.Get class is
private static final String REST_PATH = "userinfo/v2/me";
which specifies the userinfo endpoint, rather than the plus.get endpoint.
Similarly, although the Userinfoplus sure sounds like it is related to the plus endpoint, the fields in it appear to match the userinfo v2 endpoint. They certainly don't do anything to access the plus.me endpoint directly, anyway.

Spring social and facebook api 2.4

I'm using spring-social for facebook, <version>2.0.1.RELEASE</version> and it works fine if I use the 2.3 Facebook version API.
I create a new app with the version 2.4 and it doesn’t work correctly, since FB changed the API policies:
https://developers.facebook.com/blog/post/2015/07/08/graph-api-v2.4/
Fewer default fields for faster performance:
To help improve
performance on mobile network connections, we've reduced the number of
fields that the API returns by default. You should now use the
?fields=field1,field2 syntax to declare all the fields you want the
API to return.
For example the post contains only the id and message and not from-name and from-id, so the class Post contains only this two fields.
Now to read this value we need to add “?fields=from”.
The question is, is there a way to use spring social also with the version 2.4 ?
It seems that the problem persists. So, I am using as workaround the following method to bring back the fields I need:
Facebook facebook = new FacebookTemplate(accessToken);
Post post = facebook.fetchObject(postId, Post.class, "picture, message, source, story, caption, place, description, type, from, link, icon, shares, created_time, name");

Resources