Unable to import test results to jira via rest api - rest

i'm using the following curl command to import the output.xml file into jira test execution key and receiving error as below. I'm sure the test execution key is existing in jira and the project id is also correct. Any pointers?
curl -H "Content-Type: multipart/form-data" -u userid:pass -F "file=#output.xml" "https://server/rest/raven/latest/import/execution/robot?projectKey=PROJKEY+and+testExecKey=TESTEXNKEY" -o error.txt
The error i receive is as below
The User "userid" does not have permission to create issues
Why does it try to create new issue while the issue already exists? And why does it say the user doesn't have access when the access is there?

You probably mean Xray add-on and you probably use the same request per their documentation. The problem seems to be with your parameter syntax. It should be .../robot/?projectKey=PROJKEY&testExecKey=TESTEXNKEY (i.e. & instead of +and+).
Plus I would explicitly specify it's a POST request: curl -X POST ....
But their error message is not clear, anyway. I don't have Xray available right now, but if you keep having troubles, I would recommend checking with their support.

Related

How to get the response and logs of a Jenkins test without using the interface, from command line using curl?

I am using curl command to build a job in Jenkins:
curl --user "admin:passwd" -X POST http://localhost:8080/job/jobname/build
How can I check if the test was successful or failed and how to get the logs of that build from command line only, preferably using curl?
If you have BlueOcean plugin installed, you can query its API. This usually returns JSON output that you might need to question further.
First, you need to find the build number triggered by your curl command. Then, you need to wait until your build is over. Then, you can question the result.
A good start is:
"curl -s ${your_jenkins}/blue/rest/organizations/jenkins/pipelines/${jobname}/runs/${buildbumber}/nodes/?limit=10000"

How to create address in sawtooth-seth through REST API

I am learning sawtooth-seth. I can create key-pair and account using
seth-cli-go. In order to connect with application I need to connect it with REST API. So I used the following REST API.
curl --data '{"method":"personal_newAccount","params":["test#123"],"id":1,"jsonrpc":"2.0"}' -H "Content-Type: application/json" -X POST localhost:3030
But I got the following error msg,
{"jsonrpc":"2.0","error":{"code":-32069,"message":"Error generating key"},"id":1}
seth-rpc server error
[00:14:21.966] (7fc28042d700) ERROR Error generating key: No such file or directory (os error 2)
[00:14:21.966] (7fc28042d700) ERROR Error generating key
How to fix this? And where my key-pair will be stored?
How to fix this?
The code which producing that error message can be found here.
According to the code, this error came because it has mismatch key with the system. I think you could try curl with your keypair as well.
And where my key-pair will be stored?
I read the code to find where it stores the key. You can check the implementation of function get_key_dir() in accounts.rs, which states Some([home.to_str()?, ".sawtooth", "keys"].iter().collect())
So, your key-pair should be in your home directory.

Error with business manager owned_business endpoint: deprecation of role_based field permitted_role in v3.3

I'm trying to use the facebook business API to create a child business manager for a 3rd party page.
I've been following the documentation which gives the following as an example of how to create a child business manager.
curl \
-F 'id=<Parent Business Manager Id>' \
-F 'name=Advertisers child BM' \
-F 'vertical=OTHER' \ // Specify the Business vertical
-F 'shared_page_id=<PAGE_ID_FROM_USER>' \ //Optional parameter
-F 'page_permitted_roles=["ADVERTISER"]' \
-F 'timezone_id=1' \
-F 'access_token=<CLIENTS_ACCESS_TOKEN>' \
-F 'appsecret_proof=<APP_SECRET>' \
https://graph.facebook.com/<API_VERSION>/<PARENT_BM_Id>/owned_businesses
Unfortunately, when I do this request I'm getting the following error:
(#12) Deprecated role based field in two tier endpoints as of V3.3 is deprecated for versions v3.3 and higher
Which I'm assuming corresponds to the following from the v3.3 release notes:
Deprecated the role_based field permitted_role in Business Manager API. The following endpoint is impacted: POST {business-id}/owned_businesses.
After seeing that I figured the best thing to do would be to simply remove page_permitted_roles from my request. Unfortunately, that resulted in the following error:
The parameter page_permitted_roles or page_permitted_tasks is required when sharing page access
I figured maybe ADVERTISER was deprecated form page_permitted_roles, so I tried ADMIN instead, which resulted in the following error:
Param page_permitted_roles[0] must be one of {MANAGER, CONTENT_CREATOR, MODERATOR, ADVERTISER, INSIGHTS_ANALYST}
which..... gets us right back where we started.
I'm fairly sure I'm using the right access_token, appsecret_proof, etc, but I suppose it's possible I'm not. I am using the access token from a login request with the business_manager scope though, which I think is right.
If anyone has any insight into this, it would be much appreciated!
Well... the answer to this is a bit anticlimactic. I figured it out myself when I tried with a fresh head this morning.
This line was the hint:
The parameter page_permitted_roles or page_permitted_tasks is required when sharing page access
It turns out that using page_permitted_tasks solves the problem. I'm now using
-F 'page_permitted_tasks=["ADVERTISE"]' \
which doesn't give me any errors.

Unable to understand the cURL invocation

I am currently using jpmml openscoring REST API..
I have successfully installed Maven and built the uber-JAR file and I am also able to access
http://localhost:8080/OpenScoring/rules.pmml
I am confused with the instructions given at
https://github.com/jpmml/openscoring.
It says the sample curl invocation is
curl -X GET htttp://localhost:8080/openscoring/model
but I am getting a 404 error when I try to implement this. What does model mean here?
I am getting an output when I implement this:
curl -X GET htttp://localhost:8080/Openscoring/rules.pmml
The /model/ part of the path identifies the resource type. The general formula for the path component of Openscoring service URLs is /<context path>/<resource type>/<resource identifier>/<action>
In your case (assuming that the model identifier is rules.pmml), the correct path component would be /openscoring/model/rules.pmml.
I was getting a 404 error as I did not put my rules.pmml file in the directory which my command prompt pointed to.(This was a very silly mistake)
And thanks to the user Anik Islam Abhi in the comments, I found out what model in the invocation
curl -X GET htttp://localhost:8080/openscoring/model meant.
model is just an Endpoint of the REST source but not a directory in the openscoring folder or any kind of path.

Cannot set more than one Meta data with OpenStack Swift Object

I am trying to set metadata with a Object stored in Swift Container. I am using following command (note that my container is 'container1' and object is 'employee.json':
curl -X POST -H "X-Auth-Token:$TOKEN" -H 'X-Object-Meta-metadata1: value' $STORAGE_URL/container1/employee.json
It works fine with one metadata. But whenever, I am trying to set more than one metadata issuing several curl commands, only the last metadata value is actually set.
I think, there should not be a limit that you can set only one metadata for a swift object. Am I doing anything wrong?
FYI: I am using Havana release of Openstack Swift.
Thank you.
I think, I have figured it out... Its my bad that I did not read documentation sincerely.
It [1] says, "A POST request will delete all existing metadata added with a previous PUT/POST."
So, I tried this and it worked...
curl -X POST -H "X-Auth-Token:$TOKEN" -H 'X-Object-Meta-p1:[P1]' -H 'X-Object-Meta-p2:[P1]' $STORAGE_URL/container1/employee.json
Here, instead of two POST requests, now I have set multiple metadata in a single POST request.
Again, thanks.
Ref:
http://docs.openstack.org/api/openstack-object-storage/1.0/content/update-object-metadata.html