12.07.2015 Views

Ridgeline 4.0 REST API Quick Start PDF - Extreme Networks

Ridgeline 4.0 REST API Quick Start PDF - Extreme Networks

Ridgeline 4.0 REST API Quick Start PDF - Extreme Networks

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Using the <strong>REST</strong> <strong>API</strong>}package com.extremenetworks.library;import java.util.List;import javax.we.rs.GET;import javax.we.rs.Path;import javax.we.rs.Produces;import javax.we.rs.QueryParam;@Path("/devices")@Produces("text/xml")public interface DeviceManager{@GET@Path("/")public List all();//URL http://HOST:PORT/WEBCONTEXT/dataservice/device?ip=1.1.1.1@GET@Path("/device/{ip}")public Device getDevice(@QueryParam("ip") int deviceId);}package com.extremenetworks.library;import java.util.Arrays;import java.util.List;public class DeviceManagerBean implements DeviceManager{@Overridepublic List all() {return Arrays.asList(new Device("l.1.1.1", "Device 1"),new Device("2.2.2.2", "Device 2"));}@Overridepublic Device getDevice(int deviceId) {return new Device("1.1.1.1", "Device 1");}}Data URL : http://localhost:8080/extreme/dataservice/devicesOutput in XML---1.1.1.1Device 1-2.2.2.2Device 2<strong>Ridgeline</strong> <strong>4.0</strong> <strong>REST</strong> <strong>API</strong> <strong>Quick</strong> <strong>Start</strong> 22

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!