404 error when calling cognos report in bluemix application - ibm-cloud

I created an app on Bluemix and successfully created a cognos report with sample data using the Embeddable Reporting app. I have saved the report as well. And now I want to display the output of the report on the sample app page. I updated the index.html of my application to invoke the following code
var urlRoot = "/ba/cre/";
var report = new XMLHttpRequest();
var reportID = "ff4012c7689d60845d7f1187cb2133c2";
var reportUrl = urlRoot + 'report/' + reportID + "/run.json";
report.open("GET", reportUrl, true);
report.send();
For this, I get a 404 Not Found error. From all the sample code online, I know there are 2 formats phtml and json. I presume phtml is for Visualization. Anyway, I tried that as well. Same error.
Is the constructed URL correct? Is there some direct Cognos report URL that I can try and check if the report is accessible. I know that was possible with the full Cognos version. In this bluemix version, what is the direct Cognos report URL that can be used?

Looks like you are looking at an old version of the documentation. The API was updated significantly earlier this year.
Please take a look at the new docs here: https://www.ng.bluemix.net/docs/#services/EmbeddableReporting/index.html#gettingstartedtemplate
Includes a sample using the new API, and the full REST API documentation.

Related

Confluence Cloud - How to update content status via the API

I'm struggling with how to find the content status of a page in Confluence.
My end goal is to be able to change/update via the API.
I've added the list of statuses already in the Manage space section. I have successfully pulled the content of a page as well as its properties, but I can’t seem to find where the content status is stored.
Here is the URI I'm using:
https://MyDomain.atlassian.net/wiki/rest/api/content/145468621376?expand=space,body.storage,view,version.status,container,extentions
That Status is not present in OOB Confluence, so I suppose it is some third-party app from Atlassian Marketplace and you need to check with their documentation how to interact with it.
Of course, you can directly use the REST API to get page content as a string (HTML) and change its content, e.g. using Python (Atlassian Python API’s documentation)
Page actions
def my_page = confluence.get_page_property(page_id, page_property_key)
def new_body = my_page.body.replace("<macro .....>", "<new status in HTML>")
confluence.update_or_create(parent_id, title, new_body, representation='storage')
Finally sorted it out with the help of Atlassian support. If their documentation was correct it would've been super easy to do this.
https://developer.atlassian.com/cloud/confluence/rest/api-group-content-states/#api-group-content-states
Heres the catch. when you GET the status you have to add on the parameter for status even though its optional. so your get string needs to look like this:
your-domain.atlassian.net/wiki/rest/api/content{id}/state?status=current
Same goes for setting the new state. You have to add on the status parameter to the uri.

How to get all sheets listed in my organization using SmartSheet API?

Is it possible to get all the sheets from my organization when the method only defaults the data result to 100?
https://smartsheet-platform.github.io/api-docs/?csharp#list-all-org-sheets
// Set the Access Token
Token token = new Token();
token.AccessToken = System.Configuration.ConfigurationManager.AppSettings["ss-token"].ToString();
// Using the Smartsheet builder to create a Smartsheet
SmartsheetClient smartsheet = new SmartsheetBuilder().SetAccessToken(token.AccessToken).Build();
var orgList = smartsheet
.UserResources // Gets All Org Sheets
.SheetResources
.ListSheets(); // no overloads for this method
It looks like you've discovered a bug with the C# SDK. i.e., the method smartsheet.UserResources.SheetResources.ListSheets() should give you the ability to specify an input parameter that would result in the ?includeAll=true querystring parameter/value being added to the Request URL. Unfortunately, it doesn't look like this functionality has been implemented in the SDK.
If you're so inclined, you could download the SDK source code from GitHub and modify that source code to add this functionality. The request URL for getting the "List All Org Sheets" operation to return all results in a single response would be:
https://api.smartsheet.com/2.0/users/sheets?includeAll=true
(I've made note of this bug, so that we can address it in a future update to the SDK -- timeframe TBD. In the meantime, if you do end up fixing it yourself, please do submit a pull request via GitHub so that others may benefit from your fix as well.)

How to define the SAP mandant/client number in an SAPUI5 application running inside Eclipse WebApp preview?

With the Eclipse development tools for SAPUI5 it is possible to run a SAPUI5 app in WebApp preview mode. It's working fine expect one point.
The client data used in OData service is always "100" by default.
I assume the used client is the one used for repository setup.
But for testing I have to use a different client (200) because of maintained test data.
Since SAPUI5 1.26.9 and corresponding development tools it seems to work, defining a default client at SAP NetWeaver Gateway but after an upgrade to 1.28.x most of the time client 100 is used.
Now I am searching the documentation for that problem but can't find anything. One problem of course would be to that the search term "client" will not help at all.
I would also aviod to hard code any client number somewhere because at the real system the logged in client will be used automatically.
But in the WebApp preview I will not be asked for a client.
Maybe this is the wrong place to ask this question? In that case I will delete it.
Can you have a parameter in the URL and link that to retrieving your serviceUrl?
Maybe you can have a URL parameter and based on that you can 2 service URL's one with hard-coded value of client 200 and other without anything.
You can retrieve the parameter:
jQuery.sap.getUriParameters().get("test-mode") === "true";
To hard code the client in OData service definition:
var sUrl = "proxy/protocol/server:port/pathToService?sap-client=600";
var oModel = new sap.ui.model.odata.ODataModel(sUrl,true)
You could use the sap-client GET-parameter. This one will be passed to your application automatically when you used the SAP Portal or SAPGUI.
ODataModel passes it to data-service with its own.
When you call your model object, you can pass some header variables to 'point' to the right sap client.
// Set the client header variable
var oHeaders = {'sap-client': '120'};
var bCSRF = "true";
var oModel = sap.ui.model.odata.ODataModel(serviceURL, true, "user", "pass", oHeaders, bCSRF, false, false, "", false);
sap.ui.getCore().getModel(oModel, 'gAppModel')
You can test which header variables you need using a REST client like Postman.
The details of the OData constructor can be found in the API - UI5 OData Model

Throwing 404 error with the authoriseUrl generated from GetRefreshToken

I am trying to create a sample project which consumes DFP services.
Till now :
Still in authentication part :
a) Successfully created clientId, while creating new Client Id have checked installed apps options in the Google developer console.
b) Added the clientId, clientSecret to ads.properties .
Note : Took dfp-axis-jars-and-examples-2.2.0.tar and making my changes in it[by importing project in IDE].
c) I ran into trouble while trying to paste the authoriseUrl in the browser after running GetRefreshToken.
Please find below the error :
"The redirect URI in the request: urn:ietf:wg:oauth:2.0:oob can only
be used by a Client ID for native application. It is not allowed for
the 'WEB' client type. You can create a Client ID for native
application in the Credentials section of the Google Developers
Console."
I believe I have selected the wrong applicationType while creating new ClientId .
Appreciate inputs .
The above answer did not make much sense at first glance but, I have resolved this issue by simply setting a value for redirectUri. So inside of my GetRefreshToken.php file
$redirectUri = "http://same_url_as_the_one_listed_in_console";
After closing looking at the authoriseUrl, it seemed I was sending the wrong redirectUrl.
I forgot to copy paste the redirectUrl generated from the creation of client id in the GetRefreshToken callback property:
private static final String CALLBACK_URL = "https://www.example.com/oauth2callback";//"urn:ietf:wg:oauth:2.0:oob";
No error now :).

get customfield value for jira issue using JIRA SOAP API

I want to get the values of all custom fields for a particular JIRA issue using SOAP API. I have a custom field named 'Phase' having value Decision Pending for a JIRA issue JIRA-123.
I am using JIRA 5.1.3.
I am able to get all the properties of JIRA issue using SOAP API except the value of the custom field for above issue.
I tried following code, but I am not able to use ComponentManager in my code
IssueManager issueManager = ComponentManager.getInstance().getIssueManager();
CustomFieldManager customFieldManager = ComponentManager.getInstance().getCustomFieldManager();
Issue issue = issueManager.getIssueObject("JIRA-123");
CustomField customField = customFieldManager.getCustomFieldObjectByName("Phase");
Object customFieldValue = issue.getCustomFieldValue(customField);
I would highly appreciate if anyone can provide correct approach.
The SOAP API is deprecated by 5.1.3. I suggest you use the REST API - it is both more easy to use and implement.
What is REST?: read here. The basic idea is to bind HTTP request types to actions, it's quite obvious - check this table for a quick run-in.
Jira has a powerful REST API that you can use. This is the main documentation of the current release.
What do you need to do in some high-level steps?:
Set-Up some type of authentication with your JIRA instance. Be it:
Baisc - example
OAuth - example
Get a list of all fields via the API:
The /rest/api/2/field' [method returns a list of all fields][6] - both System and Custom.
Then when you identify the exact field use/rest/api/2/customFieldOption/{id}` to get the full
representation of the Custom Field Option.
I recommend you use a tools like Chrome REST Console ,or anything similar that you can easily make requests with, to get to know the API. The bonus is that you don't need to setUp authentication if you're logged in through the same browser. Your user will require full admin access though.
This is the root of all JIRA REST API docs. Check it out.
If you're doing this in PHP I would personally recommend using some kind of library. I've used
Guzzle (in a CakePHP environment) for this exact task and it turned out very well.
I'm not sure of how do you use the soap API, here is example of using it via the PHP-SOAP:
#!/usr/bin/php -q
<?php
$soapClient = new SoapClient("https://jira.com/rpc/soap/jirasoapservice-v2?wsdl");
$token = $soapClient->login('user', 'password');
$myIssue = $soapClient->getIssue($token,"TES-13");
print_r($myIssue); // all of the issue details
print_r($myIssue->customFieldValues); // get all custom fields
foreach ($myIssue->customFieldValues as $customFieldValue) {
// search for the right custom field
if ($customFieldValue->customfieldId == 'customfield_10402') {
echo $customFieldValue->values[0];
die();
}
}
?>
In case you want to use any other API, have a look at the JIRA Remote API Reference.
A remark regarding the REST and SOAP APIs -To quote from Jira's site the SOAP API "Supported but no future development". The Rest API is still a bit new and there are things you can't yet do with the REST API (example), and can be done easily using the SOAP API.