creating the task with the requited fields using Rally Rest api in java - rally

While creating a user story using Rally rest api, am getting "Validation error: HierarchicalRequirement.Story Type should not be null". I found that there is one required field that I have to pass while creating the story.. but am not sure what attribute I have to use to set it.
Here is my code
JsonObject newDefect = new JsonObject();
newDefect.addProperty("Name", "Under my story");
newDefect.addProperty("Project", "/project/51356840");
CreateRequest createRequest = new CreateRequest("hierarchicalrequirement", newDefect);
CreateResponse createResponse = restApi.create(createRequest);

My guess is that you have a required custom field called Story Type in the specified project. You may have to follow up with your administrator for more details, or browse to an existing story to see what the valid values are for that field. Once you have that data you should be able to just do something like this:
newDefect.addProperty("c_StoryType", "Foo");

Related

Here Maps {"error":"Unauthorized","error_description":"ApiKey invalid. ApiKey not found."} Documentation Error

https://developer.here.com/documentation/maps/dev_guide/topics/routing.html
{"error":"Unauthorized","error_description":"ApiKey invalid. ApiKey not found."}
I am using here maps api for routing and it's showing api key error key not found when i am passing key parameter in json format
// Instantiate a map and platform object:
var platform = new H.service.Platform({
'apikey': '{YOUR_APIKEY}'
});
The maps is working find when i pass the key as simple string i don't know if there is any error in documentation or at the api please update this on your site and check it once
the working code is below:
// Instantiate a map and platform object:
var platform = new H.service.Platform({
'apikey': 'YOUR_APIKEY'
});
just remove "{}" and it is working find
you should take your request and paste it on google search (the webpage search top bar). Remove any questionmark in the end, and you will see it will work, and will re-format the request. Copy the request from Google and try it on Postman now; hopefully it will work...
It worked for me.

How to retrieve omniture using omniture developer api

We have programmed in android to track omniture using page name using the code
Analytics.trackState(pageName, params);
The params contains lot if data like s.channel, s.prop, Prop, s.eVar
Now: We want get all the params which got recorded in omniture by hitting this link
I am trying to use the nomniture module to call Report, but it is very difficult to understand the parameters to choose a particular page
My Node.js Code
var Client = require('omniture').Client, c = new Client(username,
sharedSecret, 'sanJose'), reportData = {
"rsid_list" : [ reportSuiteId ]
}
How to use s.pageName in a request to retrieve the recorded variables for a particular custom page name
I tried to use Report.QueueTrended, Report.QueueOvertime, Report.QueueRanked followed by Report.Get but I am not getting anything
I always ended up getting errorCode 5003, The report may contain imcomplete data. Please try again later

How can I search for ldap fields when using ActiveDirectoryRealm in Apache Shiro?

We use Apache Shiro to authenticate and authorize users using our active directory.
Authenticating the user and mapping groups works just fine using the following config:
adRealm = org.apache.shiro.realm.activedirectory.ActiveDirectoryRealm
adRealm.searchBase = "OU=MYORGANIZATION,DC=MYDOMAIN,DC=COM"
adRealm.groupRolesMap = "CN=SOMEREADGROUP":"read","CN=SOMEMODIFYGROUP":"modify","CN=SOMEADMINGROUP":"admin"
adRealm.url = ldaps://my.ad.url:636
adRealm.systemUsername= systemuser
adRealm.systemPassword= secret
adRealm.principalSuffix= #myorganization.mydomain.com
I can authenticate in Shiro using the following lines:
String user = "someuser";
String password = "somepassword";
Subject currentUser = SecurityUtils.getSubject ();
if (!currentUser.isAuthenticated ()){
UsernamePasswordToken token = new UsernamePasswordToken (user,
password);
token.setRememberMe (true);
currentUser.login (token);
}
We now want to get more user information from our ActiveDirectory. How can I do that using Apache Shiro? I was not able to find anything about it in the documentation.
In the source code of ActiveDirectoryRealm I found this line:
NamingEnumeration answer = ldapContext.search(searchBase, searchFilter, searchArguments, searchCtls);
So the first part of the answer is clear: use the ldapContext to search something in it. But how can I retrieve the LdapContext?
It depends on what you are trying to do. Are you just trying to reuse the context to run a query for something other then authentication or authorization? Or are you trying to change the behavior of the query in the AD realm?
If the latter, you would need to extend the ActiveDirectoryRealm and override the queryForAuthorizationInfo() method.
Are you implementing something that is custom for your environment?
(updated)
A couple things:
The realm has access to the LdapContext in the two touch points: queryForAuthenticationInfo() and queryForAuthorizationInfo(), so if you extend the AD realm or AbstractLdapRealm you should already have it. You could change the query to return other info and add the extra info to your Principal. Then you have access to that info directly from your Subject object.
Your realms, are not required to be singletons.
If you want to do some other sort of user management (email all users with a given role, create a user, etc). Then you could create a LdapContextFactory in your shiro.ini, and use the same instance for multiple objects.
[main]
...
ldapContextFactory = org.apache.shiro.realm.ldap.JndiLdapContextFactory
ldapContextFactory.systemUsername = foobar
ldapContextFactory.systemPassword = barfoo
adRealm = org.apache.shiro.realm.activedirectory.ActiveDirectoryRealm
adRealm.ldapContextFactory = $ldapContextFactory
...
myObject = com.biz.myco.MyObject
myObject.ldapContextFactory = $ldapContextFactory
This would work well if myObject is interacting with other Shiro components, (responding to events, etc), but less so if you need access to it from another framework. You could work around this by some sort of static initialization that builds creates the ldapContextFactory, but in my opinion, this is where the sweet spot of using the shiro.ini ends, and where using Guice or Spring shines.

How to consume REST API (Liverail) via webservice using Java

I am a complete newbie to webservices but have some experience in Java. We have been provided with Liverail API documentation with a list of Entities that we can consume. This is what their doc says:
"Logical flow An API client must always use the /login method followed by the /set/entity method. All the remaining APIcalls will be executed on the selected entity. If you need to switch the current entity, you should use /unset/entity followed by a new /set/entity with the new entity ID as parameter. It is also recommended to call /logout once the API client ends its execution"
XML response format
The LiveRail API XML response is always formated like bellow.
My dilema is that i dont know how to make the GET calls.
What i would like to do in java is :
Create a http login to API webservices
Fetch a list of data (response is in XML format)
3 Convert this XML response into CSV file.
Any help will be highly appreciated.
Why not using RestTemplate?
final String uri = "http://localhost:8080/springrestexample/employees/{id}";
Map<String, String> params = new HashMap<String, String>();
params.put("id", "1");
RestTemplate restTemplate = new RestTemplate();
EmployeeVO result = restTemplate.getForObject(uri, EmployeeVO.class, params);
System.out.println(result);
Here is for more tutorials http://howtodoinjava.com/2015/02/20/spring-restful-client-resttemplate-example/

Creating trigger Dynamically in APEX

I want to create trigger dynamically in my apex class.
Can anyone here help me..
Please guide me for this.
I am fresher for visual force pages
You cannot created trigger dynamically in Apex. Because Apex code has no access to the Trigger object So, you can not create triggers programmatically. Anyways we never need to create trigger dynamically. Look here: http://boards.developerforce.com/t5/Apex-Code-Development/Create-Trigger-dynamically/td-p/667868
Sample apex code to create a trigger by Tooling API endpoint using REST callout:
String json = '{ "Name" : "COTrigger", \'+
'"TableEnumOrId" : "Custom_Object__c",'+
'"Body" : "trigger COTrigger on Custom_Object__c (after insert) { // Do Something }" }'; // JSON format to create trigger
Httprequest req = new HttpRequest();
req.setEndpoint('https://[salesforce instance].salesforce.com/services/data/v27.0/sobjects/ApexTrigger');
req.setMethod('POST');
req.setHeader('Content-Type':'application/json');
req.setHeader('Authorization':'Bearer: '+sessionId);
req.setBody(json);
Http httpReq = new HttpReq();
HttpResponse res = httpReq.send(req);
System.debug(res.getBody());
Correct some syntax error, Tooling API is basically a set of Objects, components accessible through it. Try this code, Actually I used this code to create Apex class not Apex Trigger and here i just changed body & endpoint to make it work for trigger. If it doesn't work it means creating Trigger from Tooling API is still not supported.
Read this guide http://www.salesforce.com/us/developer/docs/api_toolingpre/api_tooling.pdf It has all about tooling API and not any complex configuration is required to do this. You only need to REST callout on endpoint url to create trigger. Endpoint url are provided in guide, of which link i have given.