Message Boards
Rest Builder Example Devcon 2019 example
DYLAN CAMILO POVEDA VILLAMIZAR, modified 4 Years ago.
Rest Builder Example Devcon 2019 example
New Member Posts: 4 Join Date: 4/23/20 Recent Posts
Hi guys I was trying yo implemented the DevCon 2019 Rest Builder example publicated in this page Building an SPA Using the New Headless APIs and REST Builder https://www.liferay.com/es/web/events-devcon-recap and this video https://www.youtube.com/watch?v=ZxJCiL-LEr8 , but I got stuck when I want to test the API in PostMan, because when I send the petition this is the response
I am working with liferay-dxp-7.2.10.1 and the code is below
rest-open-apicomponents:
schemas:
Appointment:
description: Represents an appointment.
properties:
date:
format: date-time
type: string
id:
format: int64
type: integer
title:
type: string
type: object
info:
description: ""
license:
name: "Apache 2.0"
url: "http://www.apache.org/licenses/LICENSE-2.0.html"
title: "Appointments"
version: v1.0
openapi: 3.0.1
paths:
"/sites/{siteId}/appointments":
get:
operationId: getSiteAppointmentsPage
parameters:
- in: path
name: siteId
required: true
schema:
format: int64
type: integer
responses:
200:
content:
application/json:
schema:
items:
$ref: "#/components/schemas/Appointment"
type: array
application/xml:
schema:
items:
$ref: "#/components/schemas/Appointment"
type: array
description: "Get appointments"
tags: ["Appointment"]
Java CodeImplpublic class AppointmentResourceImpl extends BaseAppointmentResourceImpl {
@Override
public Page<Appointment> getSiteAppointmentsPage(
@NotNull Long siteId) throws Exception {
// TODO Auto-generated method stub
List <Appointment> appointmentList = new ArrayList<>(10);
for (int i = 0; i < 10; i++) {
Appointment appointment=new Appointment();
appointment.setId((long)i);
appointment.setTitle("Title"+i);
appointment.setDate(new Date());
appointmentList.add(appointment);
}
return Page.of(appointmentList);
}
}
Regards
I am working with liferay-dxp-7.2.10.1 and the code is below
rest-open-apicomponents:
schemas:
Appointment:
description: Represents an appointment.
properties:
date:
format: date-time
type: string
id:
format: int64
type: integer
title:
type: string
type: object
info:
description: ""
license:
name: "Apache 2.0"
url: "http://www.apache.org/licenses/LICENSE-2.0.html"
title: "Appointments"
version: v1.0
openapi: 3.0.1
paths:
"/sites/{siteId}/appointments":
get:
operationId: getSiteAppointmentsPage
parameters:
- in: path
name: siteId
required: true
schema:
format: int64
type: integer
responses:
200:
content:
application/json:
schema:
items:
$ref: "#/components/schemas/Appointment"
type: array
application/xml:
schema:
items:
$ref: "#/components/schemas/Appointment"
type: array
description: "Get appointments"
tags: ["Appointment"]
Java CodeImplpublic class AppointmentResourceImpl extends BaseAppointmentResourceImpl {
@Override
public Page<Appointment> getSiteAppointmentsPage(
@NotNull Long siteId) throws Exception {
// TODO Auto-generated method stub
List <Appointment> appointmentList = new ArrayList<>(10);
for (int i = 0; i < 10; i++) {
Appointment appointment=new Appointment();
appointment.setId((long)i);
appointment.setTitle("Title"+i);
appointment.setDate(new Date());
appointmentList.add(appointment);
}
return Page.of(appointmentList);
}
}
Regards
Attachments:
Javier Gamarra, modified 4 Years ago.
RE: Rest Builder Example Devcon 2019 example
Expert Posts: 348 Join Date: 2/12/15 Recent Posts
Which server are you using? It's a dependency issue because 2 copies of javax.validation are deployed. Can you check is the OSGi console by doing ss javax.validation?
DYLAN CAMILO POVEDA VILLAMIZAR, modified 4 Years ago.
RE: Rest Builder Example Devcon 2019 example
New Member Posts: 4 Join Date: 4/23/20 Recent Posts
Hi Javier
Im working in Liferay Digital Experience Platform 7.2.10 GA1 (Mueller / Build 7210 / May 13, 2019) TomCat and I checked this command in the console and you are right
is it possible to fix this issue?
Im working in Liferay Digital Experience Platform 7.2.10 GA1 (Mueller / Build 7210 / May 13, 2019) TomCat and I checked this command in the console and you are right
is it possible to fix this issue?
DYLAN CAMILO POVEDA VILLAMIZAR, modified 4 Years ago.
RE: Rest Builder Example Devcon 2019 example
New Member Posts: 4 Join Date: 4/23/20 Recent Posts
Welcome to Apache Felix Gogog! ss javax.validation
"Framework is launched."
id State Bundle
1399 ACTIVE javax.validation.api_2.0.0.Final
1842 ACTIVE javax.validation.api_2.0.1.Final
g!
"Framework is launched."
id State Bundle
1399 ACTIVE javax.validation.api_2.0.0.Final
1842 ACTIVE javax.validation.api_2.0.1.Final
g!
Javier Gamarra, modified 4 Years ago.
RE: Rest Builder Example Devcon 2019 example
Expert Posts: 348 Join Date: 2/12/15 Recent Posts
That's the issue. Can you do "packages validation" and see the source of the two jars? Just stop the one that does not belong to vulcan (2.0.0 probably), stop/uninstall and then restart (stop and start) vulcan-impl.
DYLAN CAMILO POVEDA VILLAMIZAR, modified 4 Years ago.
RE: Rest Builder Example Devcon 2019 example
New Member Posts: 4 Join Date: 4/23/20 Recent Posts
it Works!!Thank for your help