Error while importing xray json format result using XRAY Cloud API {"error":"Test with key XX-XX not found."} - jira-xray

I am getting error {"error":"Test with key XX-XX not found."}, while uploading xray format json test result using xray cloud APICall
XRAY Cloud End point: https://xray.cloud.getxray.app/api/v2/import/execution?testExecKey=DMY-71.
Xray formatted Json:
{
"info" : {
"summary" : "Execution of automated tests",
"description" : "This execution is automatically created when importing execution results from an external source",
"project" : "DMY",
"version" : "v1.0",
"revision" : "1234",
"startDate" : "2022-07-25T11:47:35+01:00",
"finishDate" : "2022-07-25T11:48:35+01:00",
"testEnvironments": ["Chrome"]
},
"tests" : [
{
"testKey" : "DMY-67",
"start" : "2022-07-25T11:47:35+01:00",
"finish" : "2022-07-25T11:47:35+01:00",
"status" : "PASSED"
}
]
}
I can access TestKey in jira able to Update test case too.

Related

"mapper [geo.coordinates] of different type, current_type [geo_point], merged_type [ObjectMapper]

Trying to load sample data from Kibana using the tutorial : https://www.elastic.co/guide/en/kibana/current/tutorial-load-dataset.html but facing en error of "error" : {
"type" : "illegal_argument_exception",
"reason" : "mapper [geo.coordinates] of different type, current_type [geo_point], merged_type [ObjectMapper]"
curl -H "Content-Type: application/x-ndjson" -XPOST "https://Kibana_username:Kibana_password#cd90859873ee41f2ba44736569855ac6.us-central1.gcp.cloud.es.io:9243/_bulk?pretty" --data-binary #logs.jsonl
{
"index" : {
"_index" : "logstash-2015.05.20",
"_type" : "log",
"_id" : "VLO5SWsB2ropsYqSYd-A",
"status" : 400,
"error" : {
"type" : "illegal_argument_exception",
"reason" : "mapper [geo.coordinates] of different type, current_type [geo_point], merged_type [ObjectMapper]"
}
}
}
]
}
The error that you are getting is because, in your version of logs.json, the content looks like this: {"index":{"_index":"logstash-2015.05.18","_type":"log"}} but if you read the documentation:
Indices created in Elasticsearch 6.0.0 or later may only contain a single mapping type. Indices created in 5.x with multiple mapping types will continue to function as before in Elasticsearch 6.x. Types will be deprecated in APIs in Elasticsearch 7.0.0, and completely removed in 8.0.0.
So if you change the file content like this: {"index":{"_index":"logstash-2015.05.18"}}, it would work properly.
But in the latest update of this source file, this error is fixed.

Artifactory aql: find builds of job with given property

I am trying to query which build number(s) produced artifacts from build foo with artifact property vcs.Revision=aabbccddee123456.
In Artifactory 5.1.3.
I was trying like this so far:
curl -u user:apikey -i -X POST https://artifactory.foobar.com/artifactory/api/search/aql -H "content-type:text/plain" -T query.json
query.json:
builds.find(
{
"module.artifact.item.repo":"snapshot-local",
"name":"foo",
"module.artifact.item.#vcs.Revision":"aabbccddee123456"
}
)
However, none of these 3 lines seem individually correct:
builds.find({"module.artifact.item.repo":"snapshot-local"})
returns nothing,
builds.find({"name":"foo"})
returns the same empty response,
builds.find({"module.artifact.item.#vcs.Revision":"aabbccddee123456"}) also returns this:
{
"results" : [ ],
"range" : {
"start_pos" : 0,
"end_pos" : 0,
"total" : 0
}
}
What am I doing wrong here? I do see in the webapp the builds I published with this name, and with the correct artifact properties.
Here's a working solution that will give build numbers (since giving admin rights to query builds is not a solution for us):
query.json:
items.find(
{
"repo":"snapshot-local",
"artifact.module.build.name":"foo",
"artifact.item.#vcs.Revision":"aabbccddee123456"
}
).include("artifact.module.build.number")
This returns a list of all the artifacts that were built with the relevant properties, with the build number attached, e.g:
{
"results" : [ {
"repo" : "snapshot-local",
"path" : "foo/42",
"name" : "a.out",
"type" : "file",
"size" : 123456789,
"created" : "2018-07-05T12:34:56.789+09:00",
"created_by" : "jenkins",
"modified" : "2018-07-05T12:34:56.789+09:00",
"modified_by" : "jenkins",
"updated" : "2018-07-05T12:34:56.789+09:00",
"artifacts" : [ {
"modules" : [ {
"builds" : [ {
"build.number" : "42"
} ]
} ]
} ]
},
[SNIP]
}
],
"range" : {
"start_pos" : 0,
"end_pos" : 30,
"total" : 30
}
}
I can then parse this to extract build.number.
Certain AQL queries requires a user with admin permissions.
To ensure that non-privileged users do not gain access to information without the right permissions, users without admin privileges have the following restrictions:
The primary domain in the query may only be item.
The following three fields must be included in the include directive: name, repo, and path.
In your case, you are using the build domain in the query which requires admin permissions

How cfs s3 uploading works

I've previously used slingshot and the process it pretty simple: we upload the image and it returns the uploaded url of the s3 bucket.
Now I want to resize the image and need to perform some operations on the image, so I switched to the cfs:s3 package. But when I try to upload the image, it returns some record with no url and in the db it stores it as:
{
"_id" : "Rwa7Xo65pv6cAP2aY",
"copies" : {
"thumbs" : {
"name" : "306032-facebook.jpg",
"type" : "image/jpeg",
"size" : 4262,
"key" : "thumbs/Rwa7Xo65pv6cAP2aY-306032-facebook.jpg",
"updatedAt" : ISODate("2015-02-14T06:44:04.476Z"),
"createdAt" : ISODate("2015-02-14T06:44:04.476Z")
}
},
"original" : {
"name" : "306032-facebook.jpg",
"updatedAt" : ISODate("2015-01-30T09:48:58.000Z"),
"size" : 4262,
"type" : "image/jpeg"
},
"uploadedAt" : ISODate("2015-02-14T06:43:59.062Z")
}
How can I get the URL from this record? (I suppose it is key in thumbs) Is it linking my server url to amazon s3 url?
What are the advantages of this method over slingshot?
How do I know the upload is completed? I can't figure out any ui helpers, are there any reactive helpers to track download percentage?
The URL will be your s3 end point (e.g. s3-us-west-2.amazonaws.com/) + the key. I suggest you to create a constant for your end point and a register helper to return the URL.
Something like this
Template.registerHelper('THUMBS_URL', function(key){
return S3_ENDPOINT + key;
})
I haven't used slingshot yet so can't comment on it.
There is a isUploaded helper function in collectionFS.
https://github.com/CollectionFS/Meteor-CollectionFS#isuploaded

How do you get a list of all developers and apps for an API in Apigee?

Say you have exposed an API Product in Apigee. You would like to get a list of all the developers and their apps that have registered for the API Product.
There is a call to return those, documented here:
http://apigee.com/docs/api/get-list-keys-apps-developers-or-companies-api-product
But the IDs it returns appear to be useless. If you try developers, for instance:
https://api.enterprise.apigee.com/v1/organizations/YOUR-ORG/apiproducts/YOUR-PRODUCT?query=list&entity=developers
you get back a list of IDs. But to find which developer a given ID relates to is impossible, as the call to get a developer:
http://apigee.com/docs/api/get-developer
only accepts an email address.
How can I get a list of all the developers and their apps registered for a given API product?
The Apps a developer has is nested in each developer:
https://api.enterprise.apigee.com/v1/o/{your org}/developers
will return a list of developers like this:
["email#domain.com", "email2#domain2.com"]
Then you have to loop through each developer to get a list of their apps:
https://api.enterprise.apigee.com/v1/o/{your org}/developers/tesla#weathersample.com
Which gives you a bunch of meta data including apps:
{
"apps" : [ "weather" ],
"companies" : [ ],
"email" : "tesla#weathersample.com",
"developerId" : "Hk5mmLw9kKIM95qF",
"firstName" : "Nikolai",
"lastName" : "Tesla",
"userName" : "Nikolai",
"organizationName" : "jokeindex",
"status" : "active",
"attributes" : [ ],
"createdAt" : 1357858239543,
"createdBy" : "noreply_admin#apigee.com",
"lastModifiedAt" : 1357858239543,
"lastModifiedBy" : "noreply_admin#apigee.com"
}
Finally, if you look at each app you can see the products associated with that developer app:
https://api.enterprise.apigee.com/v1/o/{your org}/developers/tesla#weathersample.com/apps/weather
Gets you this detail:
{
"accessType" : "read",
"appFamily" : "default",
"appId" : "030fdcea-cf97-40b1-96df-12084aea513c",
"attributes" : [ {
"name" : "Developer",
"value" : "tesla#weathersample.com"
}, {
"name" : "DisplayName",
"value" : "Weather"
}, {
"name" : "Notes",
"value" : "not yet"
}, {
"name" : "lastModifier",
"value" : ""
} ],
"callbackUrl" : "http://example.com/callback",
"createdAt" : 1363578857830,
"createdBy" : "adminui#apigee.com",
"credentials" : [ {
"apiProducts" : [ {
"apiproduct" : "weather",
"status" : "approved"
} ],
"attributes" : [ ],
"consumerKey" : "{key}",
"consumerSecret" : "{key}",
"expiresAt" : -1,
"scopes" : [ ],
"status" : "approved"
} ],
"developerId" : "Hk5mmLw9kKIM95qF",
"lastModifiedAt" : 1386042817268,
"lastModifiedBy" : "michael.bissell#apigee.com",
"name" : "weather",
"scopes" : [ ],
"status" : "approved"
}
Take a look at the Org Snapshot Tool on git if you want to interrogate the entire org with one script:
https://github.com/apigee/api-platform-samples/tree/master/tools
This will interrogate every developer and every app and put it into a nice tree structure in your file system for future reference.

What is the unique ID for API Products in the Apigee Edge server API?

I am using the REST API for the Apigee Edge server, and am getting the details of the API products for my organization:
https://api.enterprise.apigee.com/v1/organizations/chrisnovak/apiproducts/PremiumWeatherAPI
Here is the response:
{
"apiResources" : [ ],
"approvalType" : "auto",
"attributes" : [ {
"name" : "description",
"value" : "Premium API Product to expose the weather API to developers"
}, {
"name" : "access",
"value" : "public"
}, {
"name" : "developer.quota.limit",
"value" : "10000"
}, {
"name" : "developer.quota.interval",
"value" : "1"
}, {
"name" : "developer.quota.timeunit",
"value" : "month"
} ],
"createdAt" : 1351796304109,
"createdBy" : "noreply_admin#apigee.com",
"description" : "",
"displayName" : "Weather API",
"environments" : [ "test", "prod" ],
"lastModifiedAt" : 1386812022110,
"lastModifiedBy" : "cnovak#apigee.com",
"name" : "PremiumWeatherAPI",
"proxies" : [ "weather" ],
"quota" : "10000",
"quotaInterval" : "1",
"quotaTimeUnit" : "month",
"scopes" : [ "READ" ]
}
However, I do not see a unique key in the response, and do not see any Apigee API reference documentation for API products around what the unique key is.
My questions are:
What is the unique ID for the API products in the system?
If there is not a unique ID, what happens if the API product is renamed? I need to be able to associate API products with documentation in an external system, and if the name changes, I will no longer be able to associate that documentation with that API product.
Chris,
The unique ID is the name field. It is generated from the display name the first time you save the product. That never changes. Any later changes to the name change the displayName field but not the name.
The 'Name' field is the unique field here. if you change the display name it will not affect the name field, so you can go ahead and use the name field in your documentation.
Name field is unique here.
You can test it by changing the name field and doing a POST for apiproducts.
It will create an apiproduct with the same display name but different name field.
Then if you are using the same name field and editing just display name and trying to POST for apiproducts it will give error as below:
-bash-4.1$ POST /o/weatherapi/apiproducts -H "Accept: text/xml" -H "Content-Type: text/xml" -d #st.xml
Test
keymanagement.service.apiproduct_already_exists
ApiProduct with name yahoo1 already exists
-bash-4.1$

Resources