creating jira customfield issue - jira

Does anyone have an idea of creating an array and option type customfield issue ?
If anyone does have leads, please suggest some.
although i tried to do some changes around here but no luck.
(customfield_15101={"value": target_department})
----------main error---------
text: data was not an array
url: http://jira/rest/api/2/issue
response headers = {'X-AUSERNAME': 'rest_api', 'X-ASEN': 'SEN-2710437', 'X-XSS-Protection': '1; mode=block', 'Content-Security-Policy': "frame-ancestors 'self'", 'X-Content-Type-Options': 'nosniff', 'Transfer-Encoding': 'chunked', 'X-Seraph-LoginReason': 'OK', 'X-AREQUESTID': '362x28422825x1', 'X-ASESSIONID': 'xhojwj', 'Connection': 'close', 'Cache-Control': 'no-cache, no-store, no-transform', 'Date': 'Thu, 18 Aug 2022 05:02:01 GMT', 'X-Frame-Options': 'SAMEORIGIN', 'Server': 'Apache/2.4.6 (CentOS) PHP/5.4.16', 'Content-Type': 'application/json;charset=UTF-8', 'Access-Control-Allow-Origin': '*'}
response text = {"errorMessages":[],"errors":{"Target Department/s":"data was not an array"}}
issue = JIRA_INTERFACE.create_issue(customfield_15101={"value": target_department})
jira meta for this customfield:
{"type":"array","items":"option","custom":"com.atlassian.jira.plugin.system.customfieldtypes:multiselect","customId":15101},"name":"Target Department/s","hasDefaultValue":false,"operations":["add","set","remove"],"allowedValues":[{"self":"http://jira/rest/api/2/customFieldOption/14189","value":"All Departments","id":"14189"},

although i tried to use
issue = JIRA_INTERFACE.create_issue(customfield_15101={"value":"RPM"})
but no luck

issue = JIRA_INTERFACE.create_issue(customfield_15101={u"value":u"RPM"})
whenever you try to create issue, first retrieve values and check whether the value are unicode.

Related

I need help understanding determining Youtube username/channel name when you only have the channel ID

So according to https://developers.google.com/youtube/v3/guides/working_with_channel_ids, every account contains a unique channel ID which is independent to what used to be a username. That's all fine and dandy, as channel ID is the way to identify unique accounts. Sure, I'm all for that. Where I am confused, is when I am given a unique channel ID, how can I use this to obtain the channels preferred "username", whether it be some online alias or "real-life" name?
Specifically, I am using this API (https://developers.google.com/youtube/v3/live/docs/liveChatMessages/list?hl=en) to periodically watch as new messages are placed into my broadcast. It works, and provides data which looks like the following:
{
kind: 'youtube#liveChatMessage',
etag: 'zPV9PwBFYCiNZH_4PpspXF0ZrSs',
id: 'LCC.CikqJwoYVUNMcnBlSWl1aVF1WHphcldCZVFuc3dBEgtOaHI4d2NSUHIyQRI5ChpDTC0ybDQzcC12TUNGVVFCZlFvZDVBQUhiQRIbQ09YRjdfM2stdk1DRmZRYmZRb2QzT0FCUUEw',
snippet: {
type: 'textMessageEvent',
liveChatId: 'KicKGFVDTHJwZUlpdWlRdVh6YXJXQmVRbnN3QRILTmhyOHdjUlByMkE',
authorChannelId: 'UCLrpeIiuiQuXzarWBeQnswA',
publishedAt: '2021-11-02T23:22:37.070185+00:00',
hasDisplayContent: true,
displayMessage: 'testing once again 😀',
textMessageDetails: [Object]
}
}
As you can see, there is an authorChannelId here, which is great... Except for the fact that I can't reasonably read this as a human.
My use case is that I specifically want to have a periodically updating local app which can update me with a console message similarly formatted like so:
Bob Frank: foo bar :D
Even though I technically can have something like the following, it doesn't help me know which of my 5 friends I'm expecting in my live broadcast:
UCLrpeIiuiQuXzarWBeQnswA: foo bar :D
Ah yes... Who are you again? Can you remind me again UCLrpeIiuiQuXzarWBeQnswA?
I have also tried the following API (https://developers.google.com/youtube/v3/docs/channels/list), but it doesn't appear to give the right information either. With part: "snippet" and id: "UCLrpeIiuiQuXzarWBeQnswA" I get the following output:
{
config: {
url: 'https://youtube.googleapis.com/youtube/v3/channels?part=snippet&id=UCLrpeIiuiQuXzarWBeQnswA',
method: 'GET',
userAgentDirectives: [ [Object] ],
paramsSerializer: [Function (anonymous)],
headers: {
'x-goog-api-client': 'gdcl/5.0.5 gl-node/17.0.1 auth/7.10.1',
'Accept-Encoding': 'gzip',
'User-Agent': 'google-api-nodejs-client/5.0.5 (gzip)',
Authorization: 'Bearer',
Accept: 'application/json'
},
params: { part: 'snippet', id: 'UCLrpeIiuiQuXzarWBeQnswA' },
validateStatus: [Function (anonymous)],
retry: true,
responseType: 'json'
},
data: {
kind: 'youtube#channelListResponse',
etag: 'wjX6CX2hdUPFAc4y6OCUDDjXT6o',
pageInfo: { totalResults: 1, resultsPerPage: 5 },
items: [ [Object] ]
},
headers: {
'alt-svc': 'h3=":443"; ma=2592000,h3-29=":443"; ma=2592000,h3-Q050=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43"',
'cache-control': 'private',
connection: 'close',
'content-encoding': 'gzip',
'content-type': 'application/json; charset=UTF-8',
date: 'Wed, 03 Nov 2021 01:30:32 GMT',
server: 'scaffolding on HTTPServer2',
'transfer-encoding': 'chunked',
vary: 'Origin, X-Origin, Referer',
'x-content-type-options': 'nosniff',
'x-frame-options': 'SAMEORIGIN',
'x-xss-protection': '0'
},
status: 200,
statusText: 'OK',
request: {
responseURL: 'https://youtube.googleapis.com/youtube/v3/channels?part=snippet&id=UCLrpeIiuiQuXzarWBeQnswA'
}
}
So, any help would be greatly appreciated! Thanks!
Edit: removed access token. Whoops.
Edit2: Answer was in the question, but helped by the accepted answer below. Thank you Benjamin! The real answer is to go further into the final response above.... response.data.items[0].snippet.title. nodejs console.log() in this case did not expand each item and I totally missed this detail. My bad, I'm a novice in node and javascript. You can also use the API key as Benjamin points out, but at this point I've already got access to Oauth2 so I'll keep using the same auth.
Indeed Channels: list is the way to go.
Just by accessing and parsing the JSON at this URL https://youtube.googleapis.com/youtube/v3/channels?part=snippet&id=A_CHANNEL_ID&key=YOUR_API_KEY. It has a field "title" in its "snippet" which seems to be exactly what you want.
Of course you have to change A_CHANNEL_ID with, an authorChannelId, UCLrpeIiuiQuXzarWBeQnswA for instance.

Possible bug when adding a newly created video to a playlist

As of recently, a script has been reporting failures when trying to add a newly created youtube video to a playlist.
The flow is pretty simple:
URL being requested: POST https://www.googleapis.com/upload/youtube/v3/videos?uploadType=resumable&alt=json&part=status%2Csnippet
Video id 'ABC123' was successfully uploaded.
Adding ABC123 to playlist MyPlaylistId
URL being requested: POST https://www.googleapis.com/youtube/v3/playlistItems?alt=json&part=snippet
Payload:
{"snippet": {"resourceId": {"kind": "youtube#video", "videoId": "ABC123"}, "playlistId": "MyPlaylistId"}}
Response:
{'status': '404', 'content-length': '226', 'x-xss-protection': '0', 'x-content-type-options': 'nosniff', 'transfer-encoding': 'chunked', 'vary': 'Origin, X-Origin, Referer', 'server': 'scaffolding on HTTPServer2', '-content-encoding': 'gzip', 'cache-control': 'private', 'date': 'Thu, 17 Sep 2020 12:13:36 GMT', 'x-frame-options': 'SAMEORIGIN', 'alt-svc': 'h3-Q050=":443"; ma=2592000,h3-29=":443"; ma=2592000,h3-27=":443"; ma=2592000,h3-T051=":443"; ma=2592000,h3-T050=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43"', 'content-type': 'application/json; charset=UTF-8'}
Response content:
{
"error": {
"code": 404,
"message": "Video not found.",
"errors": [
{
"message": "Video not found.",
"domain": "youtube.playlistItem",
"reason": "videoNotFound"
}
]
}
}
Now, the funny part is that the video is actually successfully added to the playlist. I have tested it several times and I get the same result.
Can anyone confirm this bug?
It seems indeed a bug, but, as far as I know, the site for post about bugs with the YouTube APIs is: Issue Tracker1.
The following link allows you create an entry on Issue Tracker.
It is worth check first if entries exists with the similar issue you're facing and if you find related entries there, please "star" that issue to draw attention to it and track updates, if you'd like.
1 Issue Tracker is shown (alongside Stack Overflow) at the end of the page of YouTube Data API website.

My resource observer closure was called twice with the same error, is this a bug?

I have a Siesta resource to which I use the closure version of AddObserver. Right now, the endpoint that that resource uses always returns a 404. Most of the time, the observing closure only gets called once with the error. However, I have a log file where I see the exact same error (same timestamp and everything) being called twice. The error looks like this:
RequestError(userMessage: "Not found", httpStatusCode: Optional(404), entity: Optional(Siesta.Entity<Any>(content: "<h2>404 - Page Not Found</h2><p>The page could not be found.</p>", charset: Optional("utf-8"), headersNormalized: ["access-control-allow-headers": "Content-Type, Authorization", "set-cookie": "connect.sid=s%3APGOwgU4q3fhlxhag0E9Sc1zN_R9jTjH0.IAp%2BfAIfqxqP%2Bt5zZ1f0t1terpWgoRHpQhF%2BfB0gxyw; Path=/; HttpOnly", "etag": "W/\"40-ca3ea152\"", "via": "1.1 vegur", "content-length": "64", "content-type": "text/html; charset=utf-8", "date": "Sun, 17 Sep 2017 01:05:43 GMT", "access-control-allow-methods": "DELETE,GET,PATCH,POST,PUT", "connection": "keep-alive", "x-powered-by": "Express", "vary": "Accept-Encoding", "server": "Cowboy", "access-control-allow-origin": "*"], timestamp: 527303143.37699503)), cause: nil, timestamp: 527303143.37563998)
Are there cases where I should receive this error twice? Is it not a guarantee that the observer is only called once in this situation? Is it a bug??? Is that bug in Siesta, the networking library, or my code?

Empty array with twitter rest get user_timeline

I'm trying to play with the twitter API. I did the oauth process, but when trying to get the user_timeline I get an empty array (but no authentication error, the http response is 200).
Any reason why this can happen?
this is the http response I get (I removed all oauth data...)
{'status': '200', 'x-ratelimit-remaining': '337', 'content-location': u'http://api.twitter.com/1/statuses/user_timeline.json?oauth_body_hash=....', 'x-transaction': '346e76fdbb36e2d8', 'set-cookie': 'guest_id="v1:134652550000237401"; Expires=Mon, 1-Sep-2014 18:51:40 GMT; Path=/; Domain=.twitter.com, lang=en', 'expires': 'Tue, 31 Mar 1981 05:00:00 GMT', 'x-access-level': 'read-write', 'content-length': '2', 'server': 'tfe', 'last-modified': 'Sat, 01 Sep 2012 18:51:40 GMT', 'x-ratelimit-limit': '350', 'pragma': 'no-cache', 'cache-control': 'no-cache, no-store, must-revalidate, pre-check=0, post-check=0', 'date': 'Sat, 01 Sep 2012 18:51:40 GMT', 'x-frame-options': 'SAMEORIGIN', 'content-type': 'application/json;charset=utf-8', '-content-encoding': 'gzip', 'x-ratelimit-class': 'api_identified', 'x-ratelimit-reset': '1346526376'}
but the content is just an empty array (in json format)
thanks.
this was dumb issue. the issue was that the user has no tweets, so this was empty. Hope no one spent time on this.

Neo4j REST Encoding

I'm using neo4jclient. When I try to create/update an node, special chars like äöü are replaced with �.
Do I have to set a specific http header like content-type, content-encoding? If yes, what kind of header and what is the value of this header?
Thanks.
EDIT:
This is how the request looks like:
POST http://...........:7474/db/data/batch HTTP/1.1
Accept: application/json;stream=true
User-Agent: RestSharp 103.1.0.0
Content-Type: application/json
Host: ............:7474
Content-Length: 267
Accept-Encoding: gzip, deflate
[
{
"method": "POST",
"to": "/node",
"body": {
"Name": "äöü",
"State": "Active",
"Id": 0,
"CreateDate": "2012-07-12T18:48:45.3343526+02:00",
"ChangeDate": "0001-01-01T00:00:00+00:00"
},
"id": 0
}
]
Or is it bug in the batch execution? If yes, I'll need the fix very quick:)
Now it works
After analyzing the messages.log we found out, that the file.encoding wasn't utf-8.
--> DEBUG [neo4j.diagnostics]: file.encoding = Cp1252
So we set in the neo4j-wrapper.conf file this property:
wrapper.java.additional.3=-Dfile.encoding=UTF-8
Now it works!!! :)
Thanks to my brother! Always good to know a Java developer. :)
There are tests for this in the codebase, so it should be handled correctly, see https://github.com/neo4j/community/blob/master/server/src/functionaltest/java/org/neo4j/server/rest/BatchOperationFunctionalTest.java#L322 . However, there might be encoding problems in the client?

Resources