How to update junit test result in to Xray using cypress javascript - junit

I was looking at the documentation of the Xray plugin : https://docs.getxray.app/display/XRAY/Import+Execution+Results+-+REST#ImportExecutionResultsREST-JUnitXMLresultsMultipart
And what I found, is a bit confusing, after a few attempts. If I'm NOT trying to import executions using the multipart
In their examples I see no way to send the test execution key for it to be updated. Which is strange, because by importing without multipart, I can set it.
The below curl command I am using to upload test result.
curl -H "Content-Type: text/xml" -X POST -H "Authorization: Bearer $token" --data #"results/test-results.xml" https://xray.cloud.xpand-it.com/api/v1/import/execution/junit?projectKey=####
Anyone has any idea how to achieve this?

Related

User not authenticated

Im trying to download a file as described in forge documentation.
So im getting an access token with scope=data:read for the first 2 steps :
curl
-v 'https://developer.api.autodesk.com/authentication/v1/authenticate'
-X 'POST'
-H 'Content-Type: application/x-www-form-urlencoded'
-d 'client_id=xxx&client_secret=xxx&grant_type=client_credentials&scope=data:read'
It works up to the GET hubs/:hub_id/projects endpoint.
Then, the GET projects/:project_id/folders/:folder_id/contents endpoint requires data:write, so im adding it:
curl
-v 'https://developer.api.autodesk.com/authentication/v1/authenticate'
-X 'POST'
-H 'Content-Type: application/x-www-form-urlencoded'
-d 'client_id=xxx&client_secret=xxx&grant_type=client_credentials&scope=data:read%20data:write'
It returns an access token without any issue, but when i use for this endpoint, i get a "User not authenticated" error.
I honestly dont know where its coming from, i tried without the url-encoded space as well, no difference.
Thanks in advance for any pointers in the right direction.

Have an R Plumber API consume JSON on POST

I'm writing and API in R using plumber that ideally will consume the JSON it receives on POST. But I cannot get the endpoint POST example to work that way, so I'm probably missing something obvious.
Using the example URL and Curl I can do the following without issue:
curl -i -X POST http://plumber.tres.tl/append/append -d "val=50"
But the way the example is presented:
POST {val: 50} -> http://plumber.tres.tl/append/append
Suggests that JSON would also be allowed. So I have tried:
curl -H "Content-Type: application/json" -X POST -d '{"val":50}' http://plumber.tres.tl/append/append
And all the variation to ensure UTF-8 encoding, comment out the " and all kinds of other combinations based mostly on what I found here on Stackoverflow about post. For example:
curl -i -X POST -H "Content-Type: application/json" http://plumber.tres.tl/append/append -d '{"val":50}'
curl -i -X POST -H "Accept: application/json" -H "Content-Type: application/json" http://plumber.tres.tl/append/append -d '{\"val\":50}'
curl -i -X POST -H "Content-Type: application/json;charset=UTF-8" http://plumber.tres.tl/append/append -d '{"val":50}'
Also using a file and trying to post it as #my.json did not work.
Maybe it is something on the Plumber side: I would expect that given the toolset to serialize the output, I can also state the expected serialization of the input. But I have not found how to do that.
This turned out to be a relatively simple issue with plumber. The function postBodyFilter calls parseQS that in turn splits on & and = and does not yet check for JSON formats (for example based on an initial { and ending }).
Since jsonlite was already imported by the package I proposed a small change to add basic JSON support in pull request #53.
Following the example in the README, the following will work after adding this patch:
curl --data '{"a":4, "b":5}' http://localhost:8000/sum
Since the call is on jsonlite to parse the content of the querystring, more complex JSON should also be possible, but I have not tested that yet.
Update : This has now been merged into the plumber project and will work for you if you install the version from github using devtools::install_github("trestletech/plumber"), or through a traditional install as soon as version 0.3.1 is available on CRAN.

Publish to Chrome Webstore using the items.Publish API and cURL

We are developing a Chrome Extension and, as part of the release build, we want to publish it to the Chrome Webstore for testing.
We are using cURL to send the http requests.
Using the information in :
https://developer.chrome.com/webstore/using_webstore_api
we have successfully updated the store, but I am seeing an odd error when trying to publish it using the information in
"Publishing an item to trusted testers" in the above link.
The command line looks like this as suggested in the link above:
curl -H "Authorization: Bearer %refresh_token%" -H "x-goog-api-version: 2" -H "Content-Length: 0" -H "publishTarget: trustedTesters" -X POST -v https://www.googleapis.com/chromewebstore/v1.1/items/%app_id%/publish
When I run this I get an error back stating that the publish condition is not met. The error message states that we should set publish_to_trusted_testers=true, but I can find no documentation suggesting how or where I should set this.
Note that access tokens are working OK, and the PUT command to upload the new extension is also successful.
Any advice would be gratefully accepted.
Jon
https://developer.chrome.com/webstore/webstore_api/items/publish#parameters
The docs on https://developer.chrome.com/webstore/using_webstore_api don't currently point to the correct use of the api, but the publish docs are correct.
I tried url query and it succeeded:
curl \
enter code here-H "Authorization: Bearer $ACCESS_TOKEN" \
-H "x-goog-api-version: 2" \
-H "Content-Length: 0" \
-X POST \
-v \
https://www.googleapis.com/chromewebstore/v1.1/items/$APP_ID/publish?publishTarget=trustedTesters

Curl hangs when trying to do a POST on a mysql db

I am using CURL to issue a POST request and sending a JSON to populate a mysql db. The issue it that curl hangs when I
issue this command. If I use the RESTClient with firefox, it works perfectly and I can populate the db with the json passed.
Its only when I am issuing the CURL that this happens.
If I remove my implementation inside the POST and just do a simple System.Out.Print, this works just fine.
Here is my curl command :
curl -i -H "Content-Type: application/json" -X POST -d '{"Time":"Dec 27, 2012 15:44:12","firstName":"John","lastName":"Doe",
"totalSalary":"10000"}' http://localhost:8080/Person/people/
Kindly let me know where I am going wrong.
Thanks,
Jack

Create new gist with Github API v3 using curl

After fighting for quite some time for posting a private gist to Github using their API V3 I almost gave up. Almost. May be some one have also faced similar problem or know what might be the reasoning of the following behavior:
Right now the curl command looks like following:
curl -H "Authorization: bearer MY_AUTHORIZATION_TOKE" -H "Accept: application/json" -H "Content-type: application/json" -X POST -d '{"public":false,"files":{"test.txt":{"content":"String file contents"}}}' https://api.github.com/gists
I also tried
curl -H "Authorization: bearer MY_AUTHORIZATION_TOKE" -X POST -d '{"public":false,"files":{"test.txt":{"content":"String file contents"}}}' https://api.github.com/gists
I am able to create gist without authorization token using exactly same data:
curl -X POST -d '{"public":true,"files":{"test.txt":{"content":"String file contents"}}}' https://api.github.com/gists
But in that case it will be anonymous
Same results if I am truing to post it as public
In any case Github returns me
HTTP/1.1 404 Not Found
{
"message": "Not Found"
}
I am pretty sure I am authorized, as curl -H "Authorization: bearer MY_AUTHORIZATION_TOKE" https://api.github.com/user returns me my user details.
Application scope is as:
https://github.com/login/oauth/authorize?client_id=...&scope=gist
So, it should have both read and write permission.
Your OAuth2 token doesn't appear to have the required gist scope.
If you run the curl commands with the -v argument you can see the scope sent to request (X-OAuth-Scopes header) and the scope required for the request (X-Accepted-OAuth-Scopes header) to successfully be performed using the token sent.
If you don't see gist listed in the X-OAuth-Scopes header value then that is your problem.