Oracle BPM Suite REST Services - java

Does anybody know how to call the REST API to get all Processes in Oracle BPM?
I already tried this without success:
http://bpm.server.com:7101/bpm/services/rest/processes
It only returns the string: "Processes.", but I need creation dates, name, id, etc...
Thanks.

Ok. It's seems that the Processes REST API is not implemented yet. Too bad.
It's is included in the WASL(/bpm/services/rest/application.wadl), but it returns the string "Processes" instead of a JSON. Follow this link for more info.

Related

Using the NCDC's Climate Data Online API with Java

I have never used a RESTful API. I want to use this API to get historical weather data, but I can't find a simple tutorial taking me from end to end making an app that uses a RESTful API in Java. I'm not sure what steps I should take to get the data.
The steps listed on the getting started page are not Java specific, so I'm not sure how to use that info. I have requested a token and got it, so I'm good on that front.
What I need help with is getting a minimal example showing how, with just a token and formatted URL, you can get JSON data from the API.
Some things I've looked into are javax.ws.rs and jersey client, but I'm not sure how to use those either.
Thanks in advance :)
Using Fetch you can do:
fetch(url, {options})
.then(data => {
// Do some stuff here
})
.catch(err => {
// Catch and display errors
})
Where the url is the one from the getting started page.
And you can get whatever data you need from data.
Say you need to save just the name in a local var, then you do:
.then(data => {
name = data.name
})

Get the user sys_id using REST API in ServiceNow?

I am trying to get the user sys_id by username using the SNOW REST API. But I couldn't find a way of doing it in the SNOW API doc.
Is it impossible to do so or any other alternative way of doing it?
Yes, this is a simple GET call. sys_id isn't returned on the default fields but will be returned if you explicitly request it:
https://[your instance].service-now.com/api/now/table/sys_user?sysparm_query=user_name%3D[your username]&sysparm_fields=sys_id&sysparm_limit=1
The REST api explorer is very handy for building and testing queries like this. You can find it by searching the navigator.

Ng file upload - url JAVA SPRING

I have quick and relatively easy question I think, but I don't get it so here I am.
So, I've got something like this:
file.upload = Upload.upload({
url: 'sendemail',
data: {file: file}
});
Whatever about rest of the code. I want to know for what is that url: section. It's for my java spring #RequestMapping("/sendemail")? Or it is for folder on my server to store the file?
Please answer me, I just want to know it :<
So when you are using Java Spring. It provides you a lots of cool annotations.
One of them is
#RequestMapping()
This annotation helps for routing your services. So when you write RequestMapping("/sendemail"), it looks for the end point sendemail and does the job accordingly.
Now to your question,
So {url: 'sendemail'} specifies that the url should end with /sendemail so as to do the mentioned job.

Unable to persist flash values on redirect in Play 2.2.x java

I'm trying to pass success & error messages using flash() but it seems that the values get lost since there's a page redirect in place. The documentation says redirect("/url").flashing but this doesn't seem to compile in play 2.2.x.
Can anyone give me pointers on how to persist these flash values? I'd appreciate any help on this.
It looks like you're trying to mix the Scala and Java implementations of flash. As the documentation for Play Java says:
public static Result save() {
flash("success", "The item has been created");
return redirect("/home");
}
Set the flash values first, then return with redirect. Flash data is only persisted across one request however, so once you leave the controller function you've redirected to, it's gone. If it still seems to be getting "lost", post where any how you're trying to retrieve the data.

PHP how to consume SOAP web services?

I'm very new in using web services. Appreciate if anyone can help me on this.
In my PHP codes, I'm trying to use the SOAP web services from another server (JIRA, java). The JIRA SOAP API is shown here.
$jirasoap = new SoapClient($jiraserver['url']);
$token = $jirasoap->login($jiraserver['username'], $jiraserver['password']);
$remoteissue = $jirasoap->getIssue($token, "issuekey");
I found that my codes have no problem to call the functions listed on that page. However, I don't know how to use the objects returned by the API calls.
My question are:
In my PHP codes, how can I use the methods in the Java class objects returned by SOAP API calls?
For example, the function $remoteissue = $jirasoap->getIssue($a, $b) will return a RemoteIssue. Based on this (http://docs.atlassian.com/rpc-jira-plugin/latest/com/atlassian/jira/rpc/soap/beans/RemoteIssue.html), there are methods like getSummary, getKey, etc. How can I use these functions in my codes?
Based on some PHP examples I found from the internet, it seems that everyone is using something like this:
$remoteissue = $jirasoap->getIssue($token, "issuekey");
$key = $remoteissue->key;
They are not using the object's methods.
Refer to this example, it seems that someone is able to do this in other languages. Can it be done in PHP too?
The problem I'm facing is that, I am trying to get the ID of an Attachment. However, it seems that we can't get the Attachment ID using this method: $attachmentid = $remoteattachment->id;. I am trying to use the $remoteattachment->getId() method.
In PHP codes, after we made a SOAP API call and received the returned objects, how do we know what data fields are available in that object?
For example,
$remoteissue = $jirasoap->getIssue($token, "issuekey");
$summary = $remoteissue->summary;
How do we know ->summary is available in $remoteissue?
When i refer to this document (http://docs.atlassian.com/rpc-jira-plugin/latest/com/atlassian/jira/rpc/soap/beans/RemoteIssue.html), I don't see it mention any data fields in RemoteIssue. How do we know we can get key, summary, etc, from this object? How do we know it is ->summary, not ->getsummary? We need to use a web browser to open the WSDL URL?
Thanks.
This question is over one year old, but to share knowledge and provide an answer to people who have this same question and found this page, here are my findings.
The document mentioned in the question is an overview of the JiraSoapService interface. This is a good reference for what functions can be called with which arguments and what they return.
If you use Java for your Jira SoapClient the returned objects are implemented, but if you use PHP, the returned objects aren't of the type stated in this documentation and do not have any of the methods mentioned. The returned objects are instances of the internal PHP class stdClass, which is a placeholder for undefined objects. The best way to know what is returned is to use var_dump() on the objects returned from the SoapCalls.
$jirasoap = new SoapClient($jiraserver['url']);
$token = $jirasoap->login($jiraserver['username'], $jiraserver['password']);
$remoteissue = $jirasoap->getIssue($token, "PROJ-1");
var_dump($remoteissue);
/* -- You will get something like this ---
object(stdClass)#2 (21) {
["id"]=> string(3) "100"
["affectsVersions"]=> array(0) { }
["assignee"]=> string(4) "user"
...
["created"]=> string(24) "2012-12-13T09:27:49.934Z"
...
["description"]=> string(17) "issue description"
....
["key"]=> string(6) "PROJ-1"
["priority"]=> string(1) "3"
["project"]=> string(4) "PROJ"
["reporter"]=> string(4) "user"
["resolution"]=> NULL
["status"]=> string(1) "1"
["summary"]=> string(15) "Project issue 1"
["type"]=> string(1) "3"
["updated"]=> string(24) "2013-01-21T16:11:43.073Z"
["votes"]=> int(0)
}
*/
// You can access data like this:
$jiraKey = $remoteissue->key;
$jiraProject = $remoteissue->project;
The document you referred to in #2 is to a Java implementation and really doesn't give you any help with PHP. If they do not publish a public API for their service (which would be unusual), then using the WSDL as a reference will let you know what objects and methods are accepted by the service and you can plan your method calls accordingly.
The technique you used to call getIssue(...) seems fine, although you should consider using try...catch in case of a SoapException.
I have used Jira SOAP in .NET project and IntelliSense hinted me what fields are available for returned object.
You can use something like VS.Php for Visual Studio or Php for Visual Studio if you are using Visual Studio.
Or you can choose one of the IDEs from here with support of IntelliSense.

Categories

Resources