How to pass multiple username in JIRA REST API to get bulk users? - jira

I am referring to below mention Rest API, It returns details of users specified in a list of usernames or key, It's mention in doc to provide Comma-separated list of usernames.
Get Bulk User Jira API
This API is working perfectly when pass single username, but when I pass multiple emails (Comma separated it doesn't work)
curl -D- \
-X GET \
-H "Authorization: Basic Secret_Key" \
-H "Content-Type: application/json" \
"https://mydomain.atlassian.net/rest/api/2/user/bulk?username=**myusername**"
Above curl command works perfectly fine, but I am not able to search multiple username in single query, if I pass comma separated usernames it returns empty result.

the document said "To specify multiple users, pass multiple username parameters". So you will need to repeat the parameter, like /user/bulk?username=**myusername**&username=**anothername**

Related

How to get a YouTube channel ID from the channel's username which includes Cyrillic characters

This is a YouTube channel URL that includes Cyrillic characters in the username:
https://www.youtube.com/c/%D0%9B%D1%83%D1%87%D1%88%D0%B8%D0%B5%D0%B4%D0%BE%D0%BA%D1%83%D0%BC%D0%B5%D0%BD%D1%82%D0%B0%D0%BB%D1%8C%D0%BD%D1%8B%D0%B5%D1%84%D0%B8%D0%BB%D1%8C%D0%BC%D1%8B/videos
I am trying to obtain the channel's id from the URL by calling the YouTube DATA API v3:
https://www.googleapis.com/youtube/v3/channels?key=[YouTubeAPIkey]&forUsername=%D0%9B%D1%83%D1%87%D1%88%D0%B8%D0%B5%D0%B4%D0%BE%D0%BA%D1%83%D0%BC%D0%B5%D0%BD%D1%82%D0%B0%D0%BB%D1%8C%D0%BD%D1%8B%D0%B5%D1%84%D0%B8%D0%BB%D1%8C%D0%BC%D1%8B&part=id
But the call returns no data.
For reference, "https://www.youtube.com/c/besogontv/videos" returns a valid result:
https://www.googleapis.com/youtube/v3/channels?key=[YouTubeAPIkey]&forUsername=besogontv
Just to see if it may work, I tried decoding the URL encoding and then re-encoding to UTF8, but it didn't make a difference.
Is there some character encoding issue I'm missing?
If you'll issue the following command (at any GNU/Linux bash prompt):
$ wget \
--quiet \
--output-document=- \
--content-on-error \
"https://www.googleapis.com/youtube/v3/channels?key=$APP_KEY&id=UCk8LWzqGcHz21FWysiXuCHw&part=brandingSettings,contentDetails,id,snippet,statistics,status,topicDetails&maxResults=1"
you'll see that лучшиедокументальныефильмы is not the channel's user name, but its customUrl!
The forUsername property does not function for a given channel's custom URL since these URLs are not guaranteed to uniquely represent any given channel.
Do convince yourself by querying on Google's issue tracker for either of these two phrases channels forusername or vanity URL to see the terse/raw official responses users got from Google's staff.
Indeed, at times, the official docs and staff responses do lack useful/meaningful clear-cut specifications and/or formulations. (I already experienced all these myself too!)
As a final note, you may scrape out of the HTML page obtained from https://www.youtube.com/c/лучшиедокументальныефильмы the channel ID of your interest, but please bear in mind that this activity is forbidden by Google, as per its DTOS docs:
Scraping
You and your API Clients must not, and must not encourage, enable, or require others to, directly or indirectly, scrape YouTube Applications or Google Applications, or obtain scraped YouTube data or content. Public search engines may scrape data only in accordance with YouTube's robots.txt file or with YouTube's prior written permission.
Instead of scraping, I'd recommend using the Search.list API endpoint, invoked with the q parameter being лучшиедокументальныефильмы and the type parameter being channel (if you're able to cope with the fuzziness implied).
Update upon answering to a related SO question
Here is a simple Python3 script implementing the functionality that you're looking for. Applying your custom URL to this script produces the expected result:
$ python3 youtube-search.py \
--custom-url Лучшиедокументальныефильмы \
--app-key ...
UCk8LWzqGcHz21FWysiXuCHw
$ python3 youtube-search.py \
--user-name Лучшиедокументальныефильмы \
--app-key ...
youtube-search.py: error: user name "Лучшиедокументальныефильмы": no associated channel found
Note that you have to pass to this script your application key as argument to the command line option --app-key (use --help for brief help info).

Twilio Programable Chat Rest API Accepting JSON

When creating a Channel the REST API seems to ignore any data in requests with a JSON body. Example:
curl -X POST https://chat.twilio.com/v2/Services/{instance sid}/Channels -H 'authorization: Basic blah blah blah' -H 'content-type: application/json' -d '{ "friendly_name": "Test Chat One", "type": "private" }'
Does the API not support JSON requests? The docs show requests with post with form data https://www.twilio.com/docs/api/chat/rest/channels?code-sample=code-create-a-channel&code-language=curl&code-sdk-version=default but not JSON??
Have I missed something?
Ta
Twilio developer evangelist here.
The Twilio API does not support JSON requests (though it will respond with JSON if you ask it to).
Check the documentation on the API here. It says:
In the PUT or POST, you represent the properties of the object you wish to update as form urlencoded key/value pairs. Don't worry, this is already the way browsers encode POSTs by default. But be sure to set the HTTP Content-Type header to "application/x-www-form-urlencoded" for your requests if you are writing your own client.

Medium API: method missing to list posts?

I see a lot of useful methods in the API, but I don't find any method to list all my Posts, or all the posts from within a publication. Is this intentional?
Thought it would be something really obvious to exist in the API. Or am I missing something?
Got it, just use the RSS feed instead.
I wrapped a Github package by #mark-fasel into a Clay microservice that enables you to do exactly this:
Simplified Return Format:
https://clay.run/services/nicoslepicos/medium-get-users-posts-simple
What Medium actually returns at the endpoint
https://clay.run/services/nicoslepicos/medium-get-users-posts
I put together a little fiddle, since a user was asking how to use the endpoint in HTML to get the titles for their last 3 points:
https://jsfiddle.net/h405m3ma/1/
You can call the API as:
curl -i -H "Content-Type: application/json" -X POST -d '{"username":"nicolaerusan"}' https://clay.run/services/nicoslepicos/medium-get-users-posts-simple
You can also use it easily in your node code using the clay-client npm package and just write:
Clay.run('nicoslepicos/medium-get-users-posts-simple', {"username":"usernameValue"}) .then((result) => {
// Do what you want with returned result console.log(result);
})
If you need to generally pull down an RSS feed, here's a microservice for that:
https://clay.run/services/nicoslepicos/rss-to-json

How can I get custom field data from the Asana API?

I've configured some custom fields for a project in Asana. How can I fetch those fields when getting tasks from the Asana API?
You can get the value of custom fields by fetching the task object directly:
curl -H "Authorization: Bearer <personal_access_token>" https://app.asana.com/api/1.0/tasks/1001
Or by adding custom_fields to the opt_fields parameter for a request which returns compact representations of tasks:
curl -H "Authorization: Bearer <personal_access_token>" https://app.asana.com/api/1.0/projects/1331/tasks?opt_fields=custom_fields

Posting attachments to Slack API

So I just understood that the Slack Web API does not support JSON data over POST. Which means I have to encode my complex and nested JSON object to fit in query parameters over GET. Problem is, the attachements don't seem to work. Does anyone have a solution ?
So I just understood that the Slack Web API does not support JSON data over POST. Which means I have to encode my complex and nested JSON object to fit in query parameters over GET.
I'm not sure I follow what you mean. You can certainly use POST. The body of a Slack API call should be form-encoded, but parameter values are sometimes JSON (as is the case for attachments).
Here's a working curl command that uses HTTP POST to post a message with a simple attachment.
$ curl -d token=<REDACTED> -d channel=<REDACTED> \
-d text="This is the main text." \
-d attachments='[{"text": "This is an attachment."}]' \
https://slack.com/api/chat.postMessage
I'd recommend using POST, but GET also works fine. If you fill in the values in https://api.slack.com/methods/chat.postMessage/test, the tool will give you a URL at the bottom that you can use with HTTP GET.

Resources