Skip to content

Instantly share code, notes, and snippets.

@ngandriau
Created September 25, 2013 17:11
Show Gist options
  • Save ngandriau/6702830 to your computer and use it in GitHub Desktop.
Save ngandriau/6702830 to your computer and use it in GitHub Desktop.
activiti secure rest call attempt
package com.hybris.activity
import groovyx.net.http.ContentType
import groovyx.net.http.RESTClient
/**
* Created by User: ngandriau - Date: 9/25/13 - Time: 12:07 PM
*
* this works: curl --basic --user kermit:kermit http://localhost:8080/activiti-rest/service/process-engine
*/
class ActivitiMonitor {
public static void main(String[] args) {
def activitiRestClient = new RESTClient("http://localhost:8080")
activitiRestClient.auth.basic "kermit", "kermit"
def response = activitiRestClient.post(
path: "/activiti-rest/service/login",
body: """{
"userId": "kermit",
"password": "kermit"
}
""",
contentType: ContentType.JSON,
requestContentType: ContentType.JSON)
println response.data
response = activitiRestClient.get(
path: "/activiti-rest/service/process-engine",
contentType: ContentType.JSON,
requestContentType: ContentType.JSON)
println response.data
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment