What kind of values can "Duration" accept in Rally? - rally

I am using the RallyRestAPI and ideally I want to pass to a test case I am creating through the API a duration time in this format "MM:SS". I am passing for example, "9:45" (9 minutes, 45 seconds), but I get an error that .."9:45 cannot convert to a double". Does the duration field in Rally only accept double values or what other type of values can it accept? Thanks.
My code is something like this:
DynamicJsonObject tcresults = new DynamicJsonObject();
// ...
tcresults["Duration"] = "9:45";
I get the error when doing this line below:
CreateResult cr = _RallyApi.Create(_workspace, "TestCaseResults", tcresults);

According to the web service docs here it has to be a double. So "9:45" would be 9.75 instead.

Related

How to passing json parameters for test api (restful) in katalon studio?

I created a demo test using reqres.in fake data API.
I want to create a user with a name and a job parameter, but the data format required is json.
In my Katalon test I tried to do that in the script tab:
My parameters are not sent to the API...
I didn't find how to do that in Katalon Studio (5.7) and I don't know if it's possible to do that.
Finally, i 've found a solution, for exemple i want to get a new token with a refresh_token_key, and send it in json format and modify my request object.
I get my refresh_token_ken, put it in a string variable, get my request object and modify the body like this :
RequestObject roRefresh_Token = findTestObject('Authentication/Refresh Token');
def jsonStr = "{'RefreshToken':'"+GlobalVariable.Refresh_Token+"'}";
roRefresh_Token.setBodyContent(new HttpTextBodyContent(jsonStr, "UTF-8", "application/json"));
WS.sendRequest(roRefresh_Token)
You didn't add parameters to the REST object.
Click the + Add button shown in the screenshot and add the following to the parameter table:
Name | Value
--------------------
name | ${name}
job | ${job}
That will change your request to https://reqres.in/api/users?name=${name}&job=${job} so when you send the request as you did in the OP, Ema and developer will go to the place of the placeholders for name and job.

How to set most recently used parameter value as Default in value prompt or text prompt in Cognos Bi

I am using Cognos Bi 10.2.2 version.
I have created a prompt page for a parameter with value prompt.I am using the parameter as "Term_Code" which containing values such as 201410,201420,201510... and I will select the Parameter value "201420" for the first time while running the report. When i run my report again in future i must get default value as 201420 which is Most recently used parameter Value. Can Anyone Know it,
How to get Most recently used parameter value as the default value in value Prompt. Please help me.
Thanks in advance.
You can create a cookie to set its value to what the user last selected. The way I've done this is to drag an HTML Item to after the prompt then inside the HTML element, you can place the JavaScript to take care of creating the cookie and setting its value.
Here is the JavaScript I used:
<script>
function createCookie(name,value,days) {
if (days) {
var date = new Date();
date.setTime(date.getTime()+(days*24*60*60*1000));
var expires = "; expires="+date.toGMTString();
}
else var expires = "";
document.cookie = name+"="+value+expires+"; path=/";
}
function readCookie(name) {
var nameEQ = name + "=";
var ca = document.cookie.split(';');
for(var i=0;i < ca.length;i++) {
var c = ca[i];
while (c.charAt(0)==' ') c = c.substring(1,c.length);
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
}
return null;
}
function subtractDay ()
{
var dtToday = new Date();
var dtYesterday = new Date( dtToday - 86400000 ); // 86400000 = 24 hours * 60 (minutes per hour) * 60 (seconds per minute) * 1000 (milliseconds per second)
var strYesterday = [dtYesterday.getUTCFullYear(), dtYesterday.getMonth()+1, dtYesterday.getDate()].join("-");
return strYesterday;
}
var x = readCookie('MyCookie');
while (x != 'Value'){
pickerControlpDatePicked.setValue(subtractDay() );
createCookie('MyCookie','Value',0);
x = readCookie('MyCookie');
}
</script>
The function pickerControlpDatePicked get the date selected (that was my use case). I think there should be a similar function for String
this is just a suggestion of a possible solution.
In Framework Manager you can make a query subject linked to a stored procedure. Every time the report is executed, the parameter Team_Code would be passed to the query linked to the stored procedure, and the stored procedure would save its value in a database table.
The next time the report is executed, the prompt page would query the table of the saved parameters for the last parameter saved, and using the JavaScript Prompt API would set this value as the default value of the prompt control in the prompt page.
I hope this helps, good luck!
Cognos is not designed to store information about prompt choices, with the one exception of report views. However, this won't help you as report view prompt values are not dynamic. You set a fixed value and it keeps that value until you change it manually.
What I would do is setup a small Web service. This would be a Web page whose purpose is to receive requests via Web URL and return information or perform some action. A single page could be created to:
Receive a new value and store it in a database, or even a cookie
Retrieve a value from the database/cookie and return it to the requester
The Cognos prompt page would have JavaScript that fired when the prompt page is first generated to retrieve the stored value via the Web service and set the prompt value to the previous selection. There would also be JavaScript that fired when the user selected a new value which would send the choice to the Web service for storage.

How to pas ISO 8601 formatted date value in GET Request

I am working on lob.com letters API. Using Postman application to test the API, facing the following error:
Postman Application to test Lob's API
The parameter "date_created" want date value in ISO 8601. I am passing the value in specified format but api returns the response having error: "date_created must be an object".
Need help!
In pre request script compute current date and set it to environment variable then you can pass it in your request body. A bit of code will look like this:
Pre Request
var date = new Date().toISOString();
postman.setEnvironmentVariable("date",date);
Request Body
// Other attribs....
"date_created" : "{{date}}"

I am trying to use Yodlee/executeUserSearchRequest as a RESTful request and need an answer on how to call

I am working with the Yodlee services in c# and using the RESTful api. So far I have successfully connected and logged in with my CobrandSession and UserSessionToken in the development environment. I used the sample apps provided in c# and with some advice from shreyans i got an app working. What I got working was
1) Get YodleeAuthentication
2) Get UserAuthentication
3) Get ItemSummaries
I am now trying to get the full transaction details for each of the Items (i.e. collections of accounts that are an Item)
reading the Docs here https://developer.yodlee.com/Indy_FinApp/Aggregation_Services_Guide/REST_API_Reference/executeUserSearchRequest it states that I need to call executeUserSearchRequest and then paginate through the results using the getUserTransactions. So I am stuck at this point. I dont really want a search which has parameters I just want ALL transactions for this account that I can see.
However, I am using the variables as defined in that page :-
var request = new RestRequest("/jsonsdk/TransactionSearchService/executeUserSearchRequest", Method.POST);
request.AddParameter("cobSessionToken", param.CobSessionToken);
request.AddParameter("userSessionToken", param.UserSessionToken);
request.AddParameter("transactionSearchRequest.containerType", param.ContainerType);
request.AddParameter("transactionSearchRequest.higherFetchLimit", param.HigherFetchLimit);
request.AddParameter("transactionSearchRequest.lowerFetchLimit", param.LowerFetchLimit);
request.AddParameter("transactionSearchRequest.resultRange.endNumber", param.EndNumber);
request.AddParameter("transactionSearchRequest.resultRange.startNumber", param.StartNumber);
request.AddParameter("transactionSearchRequest.searchFilter.currencyCode", param.CurrencyCode);
request.AddParameter("transactionSearchRequest.searchFilter.postDateRange.fromDate", param.FromDate);
request.AddParameter("transactionSearchRequest.searchFilter.postDateRange.toDate", param.ToDate);
request.AddParameter("transactionSearchRequest.searchFilter.transactionSplitType.splitType", param.SplitType);
request.AddParameter("transactionSearchRequest.ignoreUserInput", param.IgnoreUserInput);
request.AddParameter("transactionSearchRequest.searchFilter.itemAcctId", param.ItemAcctId);
var response = RestClientUtil.GetBase().Execute(request);
var content = response.Content;
return new YodleeServiceResultDto(content);
As per the response from shreyans in this posting Getting Error "Any one of [**] of transactionSearchFilter cannot be NULL OR Invalid Values I am not putting in the ClientId and the ClientName
The documentation doesn't specify the format of the dates but the example seems to tell me that its american date format. And specifies a parameter saying IgnoreUserinput, but doesnt have a parameter for user input so this is confusing
When I make a call using this format I get an error response
var getSearchResult = yodleeExecuteUserSearchRequest.Go(yodleeExecuteUserSearchRequestDto);
getSearchResult.Result="
{"errorOccured":"true","exceptionType":"Exception Occured","refrenceCode":"_60ecb1d7-a4c4-4914-b3cd-49182518ca5d"}"
But I get no error message in this and I have no idea what I have done wrong or where to look up this error, can somebody who has used Yodlee REST Api point me in the right direction as I need to get this researched quickly....
thanks your your help, advice, corrections and pointers....
Here is the list of parameters which you can try
1) For a specific ItemAccountId all transactions
transactionSearchRequest.containerType=all
transactionSearchRequest.higherFetchLimit=500
transactionSearchRequest.lowerFetchLimit=1
transactionSearchRequest.resultRange.startNumber=1
transactionSearchRequest.resultRange.endNumber=500
transactionSearchRequest.searchClients.clientId=1
transactionSearchRequest.searchClients.clientName=DataSearchService
transactionSearchRequest.searchFilter.currencyCode=USD
transactionSearchRequest.searchClients=DEFAULT_SERVICE_CLIENT
transactionSearchRequest.ignoreUserInput=true
transactionSearchRequest.ignoreManualTransactions=false
transactionSearchRequest.searchFilter.transactionSplitType=ALL_TRANSACTION
transactionSearchRequest.searchFilter.itemAccountId.identifier=10000353
2) For a Specific account (itemAccountId) with start and end dates
transactionSearchRequest.containerType=all
transactionSearchRequest.higherFetchLimit=500
transactionSearchRequest.lowerFetchLimit=1
transactionSearchRequest.resultRange.startNumber=1
transactionSearchRequest.resultRange.endNumber=500
transactionSearchRequest.searchClients.clientId=1
transactionSearchRequest.searchClients.clientName=DataSearchService
transactionSearchRequest.searchFilter.currencyCode=USD
transactionSearchRequest.searchClients=DEFAULT_SERVICE_CLIENT
transactionSearchRequest.ignoreUserInput=true
transactionSearchRequest.ignoreManualTransactions=false
transactionSearchRequest.searchFilter.transactionSplitType=ALL_TRANSACTION
transactionSearchRequest.searchFilter.itemAccountId.identifier=10000353
transactionSearchRequest.searchFilter.postDateRange.fromDate=08-01-2013
transactionSearchRequest.searchFilter.postDateRange.toDate=10-31-2013

Why does Stripe.com return error (402) Payment Required?

I'm not seeing this particular error described in stripes API anywhere. Anyone know what's going on?
Here is my VB.net code to create a customer:
Function CreateStripeCustomer(ByVal Token As String) As String
'' The Stripe Account API Token - change this for testing
Dim STR_Stripe_API_Token As String = "sk_test_SECRET_TEST_KEY" '<-- test secret key. Change to live later.
''The Stripe API URL
Dim STR_Stripe_API_URL As String = "https://api.stripe.com/v1/customers"
''Creates a Web Client
Dim OBJ_Webclient As New System.Net.WebClient()
''Creates Credentials
Dim OBJ_Credentials As New System.Net.NetworkCredential(STR_Stripe_API_Token, "MY_STRIPE.COM_PASSWORD")
''Sets the Credentials on the Web Client
OBJ_Webclient.Credentials = OBJ_Credentials
''Creates a Transaction with Data that Will be Sent to Stripe
Dim OBJ_Transaction As New System.Collections.Specialized.NameValueCollection()
OBJ_Transaction.Add("email", "PERFECTLY_VALID_EMAIL")
OBJ_Transaction.Add("card", "PERFECTLY VALID TOKEN RETURNED BY STRIPE.JS")
''The Stripe Response String
Dim STR_Response As String = Encoding.ASCII.GetString(OBJ_Webclient.UploadValues(STR_Stripe_API_URL, OBJ_Transaction))
Return STR_Response
End Function
The 402 "payment required" error is happening on the line:
Dim STR_Response As String = Encoding.ASCII.GetString(OBJ_Webclient.UploadValues(STR_Stripe_API_URL, OBJ_Transaction))
If you're seeing this in live, it's also possible the card number is simply incorrect, eg: if you inspect the body of the 402 response:
Well, I switched to my "LIVE" keys instead of my "TEST" keys, and that fixed it. Just wasted 3 hours of my life trying to fix this. Hope this helps somebody else.
The more correct answer is that you need to use the appropriate test card numbers. See https://stripe.com/docs/testing
Stripe provides a test environment in which you use the test publishable/secret keys, as oppose to waiting till production. However, what seems like the down side, which is in fact very helpful is that you need to comply to Stripe's testing conditions and use their given card numbers and inputs to test different aspects of your api call.
For example, in order to receive certain errors you can input these numbers:
card_declined: Use this special card number - 4000000000000002.
incorrect_number: Use a number that fails the Luhn check, e.g. 4242424242424241.
invalid_expiry_month: Use an invalid month e.g. 13.
invalid_expiry_year: Use a year in the past e.g. 1970.
invalid_cvc: Use a two digit number e.g. 99.
For more information refer to the link that Samir posted.
For iOS
If you are following tutorial from Ray Wunderlich website the reason why error may appear is that you run your test back end (web.rb file) and after that add you TEST_SECRET_KEY.
Go to the terminal click control+C, make sure you have already added your TEST_SECRET_KEY, save file and do ruby web.rb.
For now, everything should work fine.
For reference, I used this number of the card for testing: 4242 4242 4242 4242