I've made some custom REST APIs on top of the existing swagger APIs @ <environment>/Windchill/netmarkets/jsp/restapi/index.html
I'm not sure if they are specific to FlexPLM or not, in which it might not work for what you're looking for.
I'll make a quick Hello World tutorial for you. I'm planning on making a little more in-depth tutorial later on my website but this should get you something to play around with.
We'll be modifying the rest.properties file @ WT_HOME/codebase/com/ptc/windchill/rest/rest.properties using this xconfmanager command from WT_HOME in a Windchill Shell:
xconfmanager --add type.rest.resources=com.custom.rest.HelloWorldService-t codebase/com/ptc/windchill/rest/rest.properties -p
or you can add it as a property in the $WT_HOME\codebase\com\lcs\xconfs\flexplm.rest.properties.xconf file.
As you probably guessed it you'll need to deploy your class file to the codebase/com/custom/rest/ directory after you finish compiling it.
HelloWorldService.java should look something like this:
package com.hmk.rest;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import com.fasterxml.jackson.databind.ObjectMapper;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
@Path("/custom")
@Api(value="/HelloWorld")
public class HelloWorldService{
@GET
@Produces({MediaType.APPLICATION_JSON})
@Path("/example/{param}")
@ApiOperation(
value="Get a String of Hello World",
notes="Returns Hello World and the parameter in the query parameter",
response=String.class)
public String helloWorld(@ApiParam(value = "a string parameter!") @PathParam("param") String param) throws Exception {
String response = "Hello World" + param;
ObjectMapper mapper = new ObjectMapper();
String output = mapper.writeValueAsString(response); //.withDefaultPrettyPrinter()
return output;
}
}
That's just a simple GET operation, but we've been successful in PUT/POST operations as well. I'm currently working on a document/image page upload API at the moment.
I'm attaching a screenshot of the output of this demo.
Hope this helps and I didn't misunderstand your request.