Pivotal Tracker File Upload : fails - rest

I am attempting to POST a file to my Pivotal Tracker instance as specified by the excellent documentation found here.
I continue to get an "uploaded: False" back from the server.
- My token and project id are correct since I can POST new stories etc..
- My file is in place and accessible by the user running this command
fakeuser#fakehost:~/jobs/fakeproject/builds/51$ curl -X POST -H "X-TrackerToken: <mytoken>" -F file=#"/var/lib/jenkins/jobs/changelog.xml" https://www.pivotaltracker.com/services/v5/projects/<projid>/uploads
{
"kind": "file_attachment",
"filename": "changelog.xml",
"created_at": "2013-11-12T14:05:21Z",
"size": 128,
"id": 11111111,
"big_url": "#",
"content_type": "application/xml",
"thumbnail_url": "#",
"uploader_id": 112121212,
"thumbnailable": false,
"download_url": "/file_attachments/1212121212/download",
"uploaded": false
}

I got an email back from Pivotal Labs with an answer to this question. Thanks Pivotal Labs!
Short answer:
It's fine, that "false" is just an indicator that the background job to make that file available to your project hasnt happened yet.
From the email
...
When you upload a file to Tracker, whether via the API or the UI, an
asynchronous job has to run to complete the upload and create the
thumbnail image. So the immediate response to your request reflects
the fact that this job hasn't completed yet. I can see how confusing
this is, though.
...

Related

Send file using Axios Assyst REST API

Working in Blue Prism .Net environment utilising the HTTP utility to make calls to Axios Assyst (an IT service desk 3rd party software).
My HTTP request is as per below:
POST /assystREST/v2/site/10/attachments/binary HTTP/1.1
Host: <myserver>:<myport>
Content-Type: multipart/form-data; boundary=----WebKitFormBoundary<base64 encode here>
Accept: application/json
Authorization: Basic <base64 encoded key>
{
"eventId": 10010045,
"fileName": "C:\Users\Me\Desktop\MyFile.msg",
"attachment": "data:;base64,<base64 encoded file>
"onBehalfOfUser": "MR ROBOT",
"custom": {},
"attachedByUserId": <my ID>,
"name": "C:\Users\Me\Desktop\MyFile.msg",
"event":{
"assystRESTType": "event",
"assystRESTXMLType": "eventDto",
"id": 10010045
},
"attachedByUser":{
"assystRESTType": "assystUser",
"assystRESTXMLType": "assystUserDto",
"name": "Mr Robot - Test",
"id": <my ID>,
"shortCode": "MR ROBOT"
}
}
I can create and close my tickets but unable to send/save files to my newly created tickets. I get a HTTP STATUS CODE 410-GONE and the below exception JSON response:
{
"type": "NotFoundException",
"message": "The requested resource is not available.",
"messageKey": "rest.exceptions.NotFoundException",
"diagnostic": "Could not find resource for relative : /site/10/attachments/binary of full path: http://server:port/assystREST/v2/site/10/attachments/binary"
}
I'm following the instructions and guidelines noted in the official Axios Assyst Web Service wiki(per the below link), i.e. I'm using multipart/form-data while sending the file, a .msg file, and the binary of said file (yes I know this adds 33% more to the file size): https://wiki.axiossystems.com/assyst10SP75Wiki/index.php/Integrations:assystREST#Attachments
My issue is that 400 status codes would denote an issue on the client side but I've checked internally re firewall/port being used and nothing is being blocked.
I've reasearched 410 status codes and it would seem that the issue is server side but one that the server is not willing to elaborate on.
For testing I'm using Postman as it allows for greater flexibility rather than using Blue Prism, the JSON response is the same.
Looking for some guidance re status code 410 and possible solutions, note I've limited scope re options due to Blue Prisms .net vbo's.

How to impersonate the user in Jira add-on to use Jira REST API on behalf of user

I'm looking for help of somebody who knows something about Jira add-ons.
I'm trying to implement Jira add-on with an ability to create issues on behalf of a user.
So, I completed all steps (as I think) leading me to my goal, but I faced a problem with impersonating. When I try to create an issue using Jira REST API, I receive the following error:
{
"error": "Add-on 'com.example.myapp' disallowed to impersonate the user because 'no valid active user exists'"
}
What was done:
Folowing the getting started tutorial I created the add-on descriptor:
{
"name": "Hello World",
"description": "Atlassian Connect app",
"key": "com.example.myapp",
"baseUrl": "https://url.ngrok.io",
"vendor": {
"name": "Example, Inc.",
"url": "http://example.com"
},
"authentication": {
"type": "jwt"
},
"scopes": [
"act_as_user",
"read",
"write",
],
"lifecycle": {
"installed": "/api/created",
},
"apiVersion": 1
}
I also implemented webhook to handle 'installed' callback from add-on like described here. So, when a user installs the add-on the webhook will receive the following object:
{
'key': 'com.example.myapp',
'clientKey': '<client key>',
'oauthClientId': '<OAuth client ID>',
'publicKey': '<public key>',
'sharedSecret': '<shared secret>',
'serverVersion': '100095',
'pluginsVersion': '1.250.0',
'baseUrl': 'https://<user's domain>.atlassian.net',
'productType': 'jira',
'description': 'Description',
'eventType': 'installed'
}
Using this data I generated JWT signed with the shared secret like described in the tutorial. So, my JWT payload includes the following claims:
{
'iss': 'urn:atlassian:connect:clientid:<OAuth client ID>',
'sub': 'urn:atlassian:connect:useraccountid:<client key>',
'tnt': 'https://<user's domain>.atlassian.net',
'iss': '<created at>',
'exp': '<created at + 1 minute>'
}
The next step I performed is access token generation using auth.atlassian.io/oauth2/token endpoint and the following parameters:
grant_type=urn:ietf:params:oauth:grant-type:jwt-bearer&assertion=<my JWT>&scope=ACT_AS_USER READ WRITE
The result of all these actions is an access token witch I can use to perform REST API requests. But the error described above returned every time I try to create Jira issue performing POST [user's domain].atlassian.net/rest/api/2/issue/ with Authorization: Bearer [access_token] header.
What I've noticed is that account ID in installed callback object (clientKey) has 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' (uuid) format. But when I open my account in Jira (account in witch the add-on is installed) I see that the account ID in URL has 'YYYYYY:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' format. I prepended the subject in my JWT payload with YYYYYY part:
'sub': 'urn:atlassian:connect:useraccountid:'YYYYYY:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'
and generated a new access token using this JWT. I've used new access token to create an issue and it was successfully created, the reporter of the issue is a user installed my add-on, just like I wished.
Finally, the question is: where can I find that YYYYYY part for my add-on? How to get it automatically? What I've missed following the tutorials? Any help will be appreciated.
Thank you!

Magento 2.2.7 REST API Posting Image fails with 500

I've been using the Magento 2.1.11 web API to upload images to my site for a long time now and everything has been working well. I upgrade to Magento 2.2.7 and now I get a 500 internal server error when I try the same POST request. Does anyone know why this might be happening? Maybe some permissions on the server have changed? I'm struggling to find anything on Google. Below is the request I've been using.
POST {{URL}}/rest/all/V1/products/{{SKU}}/media
{
"entry": {
"media_type": "image",
"label": "testImage",
"position":1,
"disabled": false,
"types": [
"image"
],
"file": "testFile",
"content": {
"base64_encoded_data": "base 64 encoded string of image",
"type": "image/jpeg",
"name": "testName.jpg"
}
}
}
Thanks for the help!
Just tested on Magento 2.2.7. It works for me:
Can you set mode to developer and send me your error? Or you can check error on the var/log/system.log
You can use this command to set developer mode:
php bin/magento d:m:set developer

Kurento Media Server Throwing " Unexpected error while processing method: Factory 'PlayerEndPoint'' not found"

I am Very new to Kurento. I went through its json-rpc documentation from this link.
http://www.kurento.org/docs/5.0.3/mastering/kurento_protocol.html
1) I have installed a local kurento server which runs on the port 8888.
2) I used a tool called wscat to establish a connection to the kurento-websocket.
3) I tried to connect to the kurento-server with below command
wscat -c ws://localhost:8888/kurento
After that i got the connected prompt from the server.
From the above kurento protocol documentation link. I have used the below request json
{
"jsonrpc": "2.0",
"id": 1,
"method": "create",
"params": {
"type": "PlayerEndPoint",
"creationParams": {
"pipeline": "6829986",
"uri": "http://host/app/video.mp4"
},
"sessionId": "c93e5bf0-4fd0-4888-9411-765ff5d89b93"
}
}
But according to the docs the response which i should get after sending this request is like this.
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"value": "442352747",
"sessionId": "c93e5bf0-4fd0-4888-9411-765ff5d89b93"
}
}
But i am getting
{
"error":
{"code":-32603,
"message":"Unexpected error while processing method: Factory PlayerEndPoint not found"
},
"id":1,
"jsonrpc":"2.0"
}
If i am not wrong the above request-json is used to create a new media pipeline for player end point which is used to stream http://host/app/video.mp4.
Is there any problem in my request-json object or do i have to do something before giving this request.
please help me.
You have several problems. The first is that PlayerEndpoint is not correctly spelled (note the lower case "p" PlayerEnd-p-oint). The second is that you need to first to create a MediaPipeline before you can create a PlayerEndpoint or any other media element.
If you are new to Kurento, my recommendation is that you should try to use the official Kurento client implementations (currently available in Java and JavaScript). If you want to create your very own Kurento client, you'll need to read carefully the documentation because there are a lot of details you'll need to manage (e.g. the distributed garbage collector, the WebSocket reconnection mechanisms, etc.)

Update issue journals of redmine through Rest API

I need to create new notes in existent issues of Redmine. It will be better that this can be accomplished through the Rest API, but i'm open to other solutions.
In some parts of the doc it seems to be possible, but in others it's written (soon) as if it does not be implemented jet.
I found this post asking the same, but without response.
I've already try it and in the log appear:
Processing IssuesController#update to json (for 127.0.0.1 at
2012-01-12 16:07:03) [PUT] Parameters: {"format"=>"json",
"action"=>"update", "id"=>"8", "controller"=>"issues"} Completed in
34ms (View: 0, DB: 4) | 200 OK [http://localhost/issues/8.json]
But it's not really updated. I'm using this command to make the request
curl -v -H "Content-Type:text.json" -X PUT --data "#/tmp/8.json" -u admin:admin http://localhost:3000/issues/8.json
and the content of 8.json is:
{
"issue": {
"subject": "subject123",
"notes":"funciona el rest"
}
}
I thing that annoys me is that i'm using port 3000 but it seems to be ignored in the log response.
That JSON should work. You don't want to work with the journals themselves, you want to update the issue and add a new note. That way Redmine will create the journal for you.
Is the subject getting updated? Do you have the REST API enabled? Is the admin account allowed to update that issue?
You can also try putting the notes outside of the issues object:
{
"issue": {
"subject": "subject123"
},
"notes":"funciona el rest"
}