Add a test case in Rally using Soap UI -Rest - json

I am trying to add a test case in Rally using Soap UI and the API exposed by Rally at https://rally1.rallydev.com/slm/doc/webservice/ . I am able to do that using java code though. As per the page, i need to make a POST/PUT to achieve the same but I get error
{"CreateResult": {
"_rallyAPIMajor": "2",
"_rallyAPIMinor": "0",
"Errors": ["Not authorized to perform action: Invalid key"],
"Warnings": []
}}
The payload I am passing is as below
{
"Name": "Ignore:Newly added testcase associated to a Story3",
"Description": "Test creation of Story3",
"Owner": "https://rally1.rallydev.com/slm/webservice/v2.0/user/3215613515",
"Objective": "Test objective of Story3",
"PreConditions": "1. Hi<br>2. Hello",
"Project": "1223451",
"Notes": "Adding a test case"
}
Please help me fix the issue.
Adding a sample request
POST https://rally1.rallydev.com/slm/webservice/v2.0/testcase/create?key=abc123..... HTTP/1.1
Accept-Encoding: gzip,deflate
Content-Type: application/json
Content-Length: 464
Host: rally1.rallydev.com
Connection: Keep-Alive
User-Agent: Apache-HttpClient/4.1.1 (java 1.5)
Cookie: JSESSIONID=qs-app-07fv4cswgptt7b1vc3o58hztndw.qs-app-07; SERVERID=c1acc7f401011b9881d1497a9ef30b27acc4a1c9; __cfduid=d392a0428b5fa74f473cb1712c3d64d7a1483502577
Cookie2: $Version=1
{
"testcase": {
"Name": "Ignore:Newly added testcase associated to a Story3",
"Description": "Test creation of Story3",
"Owner": "https://rally1.rallydev.com/slm/webservice/v2.0/user/28138408395",
"Objective": "Test objective of Story3",
"WorkProduct": "https://rally1.rallydev.com/slm/webservice/v2.0/hierarchicalrequirement/61375703434",
"PreConditions": "1. Hi<br>2. Hello",
"Project": "/project/17133096258",
"Notes": "Adding a test case"
}`enter code here`
}

Does the SOAP UI client manage cookies? You'll need to be sure you're still using the same session for all your requests. The auth token passed via the key query string parameter needs to match the active session. If your request is just re-passing the basic auth credentials again it will probably generate a new session, rendering that token invalid. Usually enabling cookies in the client is enough to fix this. This is the way the toolkits we provide manage it.

I was able to successfully add a test case to a user story in Rally. What we have to do is add a header as "ZSESSIONID" with a value as ApiKey created at "https://rally1.rallydev.com/login/accounts/index.html#/keys" in a POST request. Thanks everyone for the support

Related

How to determine why an Azure Function App is not triggered by a webhook

I have:
An JavaScript Azure Function in an HTTP webhook configuration; the Function provides a URL; the Function performs an action
A webhook configured in the software I hope to receive notifications from
An Azure Logic App with an HTTP/webhook step that provides a URL for the webhook notification to go to
My goal is that the Azure Function's URL receives notifications from the software's webhook and performs an action. The Azure Logic App is for testing only.
What works
When the the Azure Logic App's URL is used in the software's webhook configuration, the desired action is performed. All works as expected.
The Azure Logic App's logging shows the JSON output from the incoming webhook. I expect (but believe this may be where I am going wrong) that this is the JSON the webhook is sending to the Azure Logic App's URL. When this JSON is used in the Azure Function UI's "Test" tab > "Request body" field, the desired action is performed. All works as expected.
When the Azure Function's URL and the JSON is in a Postman request, the desired action is performed. All works as expected.
What doesn't work
When the Azure Function's URL is used in the software's webhook configuration, no action is performed. This is of course my goal. From everything I have read, I understand that this URL as a webhook endpoint should work.
Azure Function's URL
This is from Get function URL > default (Function key).
https://<app_name>.azurewebsites.net/api/content?code=<api_key>
Other Azure Function config settings
Allowed HTTP methods: GET, POST
Authorization level: Function
The JSON I believe to be coming over the webhook
{
"headers": {
"Expect": "100-continue",
"Host": "redacted",
"X-Telligent-Webhook-Sender": "redacted",
"Content-Length": "16908",
"Content-Type": "application/json; charset=utf-8"
},
"body": {
"events": [{
"TypeId": "ec9da4f4-0703-4029-b01e-7ca9c9ed6c85",
"DateOccurred": "2018-12-17T22:55:37.7846546Z",
"EventData": {
"ActorUserId": 9999,
"ContentId": "redacted",
"ContentTypeId": "redacted",
"ForumReplyId": 9999,
"ForumThreadId": 9999,
"ForumId": 9999
}
}]
}
}
I also tried with the following test code for the same results. It aligns more closely with the sample payload data provided by the software company:
What I tried
{
"events": [{
"TypeId": "ec9da4f4-0703-4029-b01e-7ca9c9ed6c85",
"DateOccurred": "2018-12-17T22:55:37.7846546Z",
"EventData": {
"ActorUserId": 9999,
"ContentId": "redacted",
"ContentTypeId": "redacted",
"ForumReplyId": 9999,
"ForumThreadId": 9999,
"ForumId": 9999
}
}]
}
Sample payload data
{
"events": [
{
"TypeId": "407ad3bc-8269-493e-ac56-9127656527df",
"DateOccurred": "2015-12-04T16:31:55.5383926Z",
"EventData": {
"ActorUserId": 2100,
"ContentId": "4c792b81-6f09-4a45-be8c-476198ba47be"
}
},
{
"TypeId": "3b75c5b9-4705-4a97-93f5-a4941dc69bc9",
"DateOccurred": "2015-12-04T16:48:03.7343926Z",
"EventData": {
"ActorUserId": 2100,
"ContentId": "4c792b81-6f09-4a45-be8c-476198ba47be"
}
}
]
}
I do not know how to determine why the Azure Function is not triggered by the webhook. The software's API documentation does not seem to provide a way to look at the JSON being sent over the webhook, although in my inexperience I may be wrong.
Is there a mechanism within Azure, or Postman, or another tool that lets me see what JSON is being sent over the webhook? Or perhaps is there another approach to determining the cause of the issue?
Thank you for any help.
This is how I got the JSON file from Azure alerts.
Install Ruby on the server
Install Sinatra with following command gem install sinatra
Create file webhook.rb and paste code bellow
require 'sinatra'
set :port, 80
set :bind, '0.0.0.0'
post '/event' do
status 204 #successful request with no body content
request.body.rewind
request_payload = JSON.parse(request.body.read)
#append the payload to a file
File.open("events.txt", "a") do |f|
f.puts(request_payload)
end
end
Run the web service with command ruby webhook.rb
JSON fill be written to file events.txt

Getting 401 unauthorised when calling calendar api of office 365

I am trying to access the office 365 calendar api to create an event. The steps i followed are
Created app and registered it in azure
Gave permisissions to the app
Hitting https://login.microsoftonline.com/{{tenantid}}/oauth2/token to get the access token
body :
{
"grant_type":"client_credentials",
"client_id": "*****",
"client_secret": "****",
"resource":"https://outlook.office.com"
}
Response :
{
"token_type": "Bearer",
"expires_in": "3600",
"ext_expires_in": "262800",
"expires_on": "1532026206",
"not_before": "1532022306",
"resource": "https://outlook.office.com",
"access_token":"******"
}
When i pass this access token to https://outlook.office.com/api/v2.0/me/events which creates events. it gives me 401 unauthorised. Body of the request is as shown below. Someone please assist.
{
"Subject": "Discuss the Calendar REST API",
"Body": {
"ContentType": "HTML",
"Content": "I think it will meet our requirements!"
},
"Start": {
"DateTime": "2019-02-02T18:00:00",
"TimeZone": "Pacific Standard Time"
},
"End": {
"DateTime": "2019-02-02T19:00:00",
"TimeZone": "Pacific Standard Time"
},
"Attendees": [
{
"EmailAddress": {
"Address": "arulvelug#hexabot.onmicrosoft.com",
"Name": "Arulvelu G"
},
"Type": "Required"
}
]
}
To do authorization of office 365 and use REST API via Postman, here is a solution for your reference:
First: get security Token
Access [https://login.microsoftonline.com/extSTS.srf] via Http Post method. The content of the http request is as follows.
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope"
xmlns:a="http://www.w3.org/2005/08/addressing"
xmlns:u="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-
utility-1.0.xsd">
<s:Header>
<a:Action
s:mustUnderstand="1">http://schemas.xmlsoap.org/ws/2005/02/trust/RST/Issue</a:Action>
<a:ReplyTo>
<a:Address>http://www.w3.org/2005/08/addressing/anonymous</a:Address>
</a:ReplyTo>
<a:To s:mustUnderstand="1">https://login.microsoftonline.com/extSTS.srf</a:To>
<o:Security s:mustUnderstand="1"
xmlns:o="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
<o:UsernameToken>
<o:Username>[username]</o:Username>
<o:Password>[password]</o:Password>
</o:UsernameToken>
</o:Security>
</s:Header>
<s:Body>
<t:RequestSecurityToken xmlns:t="http://schemas.xmlsoap.org/ws/2005/02/trust">
<wsp:AppliesTo xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
<a:EndpointReference>
<a:Address>[endpoint]</a:Address>
</a:EndpointReference>
</wsp:AppliesTo>
<t:KeyType>http://schemas.xmlsoap.org/ws/2005/05/identity/NoProofKey</t:KeyType>
<t:RequestType>http://schemas.xmlsoap.org/ws/2005/02/trust/Issue</t:RequestType>
<t:TokenType>urn:oasis:names:tc:SAML:1.0:assertion</t:TokenType>
</t:RequestSecurityToken>
</s:Body>
</s:Envelope>
The demonstration screenshot in Postman:
And the response content will include a security token as below, we can use this security token to get Access Token of office 365.
Second: get Access Token
Here i show you how to get access token, I get it of my SharePoint using the security token.
Access [https://yourdomain.sharepoint.com/_forms/default.aspx?wa=wsignin1.0] via http Post method. The content of the request is the security token that we have got above as below.
And the response as below:
We can see that there are two cookie, rtFa and FedAuth in response header, and these two cookie need to be added to the request in subsequent request.
Third: get Request Digest
Access [https://yourdomain.sharepoint.com/_api/contextinfo] via http Post method with that two cookies which we have got above.
And the response as below:
This is the final Token we want!
Then we can use REST API of our app in O365, like SharePoint , we only need to add this token and the previous two cookie, as shown in the following figure.

STH getting historical raw context

I installed Orion and Fiware STH in order to use the minimalistic option.
The problem is that when i subscribe to an orion context then consult, the array is null.
"name": "temperature",
"values": []
In the STH log it says:
ERROR when collecting the raw data collection for retrieval (the collection may not exist).
I noticed that when i try to unsubscribe it returns a 200 OK message with the following body:
{
"subscriptionId": "xxx",
"statusCode": {
"code": "404",
"reasonPhrase": "No context element found",
"details": "subscriptionId: /xxx/"
}
}
EDIT: The request URL is:
192.168.60.117:8080/STH/v1/contextEntities/type/room/id/Room‌​1/
(In my case the type is "room" and not "Room"). The headers are Accept,
Content-Type, Fiware-Service, Fiware-ServicePath
It looks like more a problem when you make the subscription to ORION than when the data is processed by STH, you can find how to make the subscription in Orion and how to notify to STH in this link: https://fiware-sth-comet.readthedocs.io/en/latest/data-storage/index.html, Also, if you provide more information of how you make the subscription and the logs I could have a better view of where is the problem and I can help you in a better way.

"Invalid JSON","error":"invalid_value"

Hi I am trying to use workato to create a task for Podio. I have successfully connected to Podio using their HTTP OAUTH2 connection, but when I try to actually create the task using JSON, I receive this from Podio:
This is from HTTP:
400 Bad Request:
{"error_parameters":{},"error_detail":null,"error_propagate":false,"request":{"url":"http://api.podio.com/task/","query_string":"","method":"POST"},"error_description":"Invalid
JSON","error":"invalid_value"}
The Code is as follows:
Request URL : https://api.podio.com/task/item/"the item id" <--This is where I would place the itemID of the item in Podio
Request header:
Authorization: OAuth2 [[User.SiteAccessToken]]
Content-type: application/json
Request Body:
{
"text": "Regarding Absence Request for Vacation",
"responsible":"{"type":profile, "id": "this is my profileID" }",
"description": "Your request for Vacation has been denied, please contact your manager."
}
but when I run this, I get this error message:
400 Bad Request:
{"error_parameters":{},"error_detail":null,"error_propagate":false,"request":{"url":"http://api.podio.com/task/item/436023600","query_string":"","method":"POST"},"error_description":"Invalid
JSON","error":"invalid_value"}
Now within the the request body or header does it need to have which app I am referring to not just the item ID. Not sure what it's looking for, if you could please assist with some guidance, that would be greatly appreciated.
I discovered that the issue was indeed the syntax within the JSON sent in the request body.
The quotes around the curly braces for responsible needed to be removed and I needed quotes with profile, and it should have gone like this:
{
"text": "Regarding Absence Request for Vacation",
"responsible": {"type":"profile", "id": 123 },
"description": "Your request for Vacation has been denied, please contact your manager."
}

authorization_invalid_request error when preparing DocuSign envelope for tab modification

I am trying trying to create a draft envelope from a template and then modify some of the tabs in the template. I'm getting an AUTHORIZATION_INVALID_REQUEST response.
My initial request is to the following URL https://demo.docusign.net/restapi/v2/accounts/<account id>/envelopes
and the payload is as follows:
{
"status": "created",
"emailSubject": "2015-01-27T16:25:43.133-05:00 Docusign Template Request",
"emailBlurb": "email blurb",
"templateId": "<template id>",
"brandId": "<brand id>",
"templateRoles": [
{
"name": "<name>",
"email": "<email>",
"roleName": "<role>",
"clientUserId": "",
"emailNotification": {
"supportedLanguage": "en",
"emailSubject": "<subject>",
"emailBody": "special email body"
}
}
],
"allowReassign": "true",
"enableWetSign": "false",
"messageLock": "false"
}
That produces the following response:
{
"envelopeId": "<envelope id>",
"uri": "/envelopes/<envelope id>",
"statusDateTime": "2015-01-28T22:09:43.9770000Z",
"status": "created"
}
Then I send a recipient view request to the following URL:
https://demo.docusign.net/restapi/v2/envelopes/<envelope id>/views/recipient using the envelope id received in the above response.
This results in the following response:
{
"errorCode": "AUTHORIZATION_INVALID_REQUEST",
"message": "The authorization request is malformed."
}
Note that if I had set the first request above to a status of "sent" (and thus did not create a draft envelope), the second request would have been successful.
However according to DocuSign documentation (p. 163 of the API guide), the modify tabs API call "modifies one or more tabs for a recipient to a draft envelope". Accordingly to perform a tab modification I need a draft envelope, not a sent one. But when I create a draft envelope, the views/recipient call fails as above.
I can add tabs successfully to a "sent" envelope. But I would rather modify tabs and am having trouble doing that.
You're not hitting a valid DocuSign Endpoint. Where did you get the /v2/envelopes/<envelope id>/views/recipient URL from? That's not a proper URL hence the error message you are getting.
After you create the envelope if you want to modify a given recipient's tabs then you need to make the following API call:
Modify Tabs for Recipient
Note that this is a PUT call not a POST, and URI is:
/accounts/{accountId}/envelopes/{envelopeId}/recipients/{recipientId}/tabs
For example, if you wanted to modify tabs for recipient who is recipientId = 3 you would make a call similar to (notice the 3 in the URL):
PUT https://demo.docusign.net/restapi/v2/accounts/12345/envelopes/{envelopeId}/
recipients/3/tabs
X-DocuSign-Authentication: <DocuSignCredentials><Username>{name}</Username><Password>{password}</Password><IntegratorKey>{integrator_key}</IntegratorKey></DocuSignCredentials>
Accept: application/json
Content-Type: application/json
{
"approveTabs":[{
<Tab information removed>
}],
"titleTabs":[{
<Tab information removed>
}],
"signHereTabs":[{
<Tab information removed>
}]
}
I'm not sure if this qualifies as an "answer" to my question, but it does appear that the problem has somehow been resolved. I let it rest for a couple days while I attended to other matters, then yesterday afternoon suddenly it started working, with no changes on my part. The specific part that wasn't working was attempting a PUT on an envelope in order to modify the tags. That is not supposed to work unless the envelope is a draft; my envelopes have all been drafts. Wasn't working a couple days ago, and now it is. #Pete and #Dorian: you might want to try it again if you haven't already; if you're not doing anything else wrong it might work now.