Search Confluence Cloud content via REST API by label and expand metadata - confluence

The goal is to retrieve from Confluence Cloud all the pages containing label some-label.
When searching Confluence using cql the query does return result set but does not include metadata (specifically labels), though expand key is explicitly passed to the query:
https://foobar.atlassian.net/wiki/rest/api/search/?expand=metadata.labels&cql=type=page&label="some-label"
What is the reason for expand being neglected? Or is the query itself misconfigured?
I used Confluence Search API Reference

Having trying to solve the same issue for while. It's simply a different method.
GET /wiki/rest/api/search does not support expansion, although the parameter is listed in the documentation
GET /wiki/rest/api/content/search does support expansion.
The confluence documentation for the latter includes all properties which can be expanded.
https://developer.atlassian.com/cloud/confluence/rest/api-group-content/#api-wiki-rest-api-content-search-get

Related

How can I specify multiple languages when sending a GET request to GitHub search API

I wonder how can I send a GET request to GitHub search API, specifically https://api.github.com/search/repositories and make the query to include several languages instead of one.
Here's my current query.
https://api.github.com/search/repositories?q=stars:%3E=1000+language:scala&sort=stars&order=desc&per_page=10
I have tried doing something like this but it didn't work as well
https://api.github.com/search/repositories?q=stars:%3E=1000+language:[scala, java]&sort=stars&order=desc&per_page=10
Thanks for your help
You need to pass in multiple language: element for being able to pass multiple languages to the query as per the doc.
For your specific case, the query would be :
https://api.github.com/search/repositories?q=stars:%3E=1000+language:scala+language:java&sort=stars&order=desc
with pagination applied it would be :
https://api.github.com/search/repositories?q=stars:%3E=1000+language:scala+language:java&sort=stars&order=desc&per_page=10
However, with pagination applied your search results will be limited in the browser.

Retrieve Grafana dashboard query using the API

I would like to get the query used in each of my dashboards using the Grafana API.
The expr field in the JSON model menu of the UI seems to contain the query. Is there a way of querying this using the API?
You can't do that. There is no official API which will return all "dashboard queries". It isn't possible, because frontend in the browser generate that and exact query depends on the user input (e.g. time range, dashboard variables, used macros, ....) and also used datasource.

Getting user/users details based on user name/alias as parameter in azure devops

I've a tool(web application) which creates work-items in azure devops. (skipping the unnecessary details), just like how we assign any user a particular work-item from the Assigned To dropdown in azure devops, I too have a dropdown which when user enters any name/alias, a list of users starts showing based on the input.
The api which I was using in the backend was
https://abcorganization.vsaex.visualstudio.com/_apis/UserEntitlements?top=10&filter=name+eq+%27Tejas
Here filter=name+eq+%27Tejas in the query parameter helps to query the api and used to give set of users whose name starts with Tejas. It can be email alias too.
But for some reason, that doesn't work anymore. My guess, they've deprecated that API version
So in my search to find the alternative/answer, I came across the following documentation:
(https://learn.microsoft.com/en-us/rest/api/azure/devops/graph/users/get?view=azure-devops-rest-5.1) in which the API given is: https://vssps.dev.azure.com/abcorganization/_apis/graph/users/{userDescriptor}?api-version=5.1-preview.1
Here the userDescriptor is some sort of unique key of AAD related to a particular user. (which I certainly can't use to fulfill my purpose).
The other thing which I've tried is the below query parameters but it still didn't worked out
https://vssps.dev.azure.com/abcorganization/_apis/graph/users?subjectTypes={subjectTypes}&continuationToken={continuationToken}&api-version=5.1-preview.1
So is there anyway/api which can fullfil my purpose or is it that I'm using this new API in a wrong way or something?
Any help would be much appreciated
I believe it should be $filter in the query. You are also missing the closing quote.
(See docs for more details)
https://abcorganization.vsaex.visualstudio.com/_apis/UserEntitlements?top=10&$filter=name+eq+'Tejas'
Use this. I tested it and worked for me:
https://vsaex.dev.azure.com/{organization}/_apis/userentitlements?$filter=name+eq+%27{name}%27&api-version=6.0-preview.3
Replace {organization} and {name} as needed

Import Possible Answer Units into Watson Discovery

I have a follow up question off of the question here:
How to get exact answers instead of the whole document using Watson Discovery?
One of the answers mentioned using the Document Conversion Service to create Possible Answer Units (PAUs) within my document. When I do this and upload this large JSON file that contains all of the PAUs, Discovery still returns the entire document that contains all of the PAUs, which I guess is expected.
To complete the solution, I assume I would have to break down each individual PAU into its own document. Does Discovery have a built in tool to do this, or do I need to write my own script?
(Ideally the script would contain some reference to the original file name/metadata and maintain the hierarchical structure that the Document Conversion Service created from my Header definitions)
Watson Discovery doesn't provide the service of giving some section of document as an answer to your query.
If you have such things in your mind, I would suggest you to use Retrieve and Rank service, which basically helps you to train watson and to get expected answer section from your provided documents.
Note: R&R service uses Document Conversion service internally
Now you can use the new passage retrieval feature to do that. It is available as "Include matching passages" in the WDS tooling or in the API reference
Passages query boolean A boolean that specifies whether the service returns a set of the most relevant passages from the documents returned by a query. The default is false.
Note: The passages parameter works only on private collections. It does not work in the Watson Discovery News collection. "

Ckan API, List more information on rest dataset

I am using ckan 2.6.0
According with the documentation: http://docs.ckan.org/en/latest/api/legacy-api.html
I am trying to use the endpoint /rest/dataset and works (only for public data but works), it only returns an array of datasets names, and nothing else, an example can be found here http://demo.ckan.org/api/1/rest/dataset
Is there a way to get a complete listing for datasets ? I also tried the search endpoint and returns the same array.
For example I would like to get the title, description, tags, file types, etc, like in the image below:
The REST api is deprecated/unmaintained and has been for a long time. Follow the up-to-date API documentation here.
package_search is your best bet: http://demo.ckan.org/api/action/package_search
That gives you a batch of datasets. Get more by paging through using the 'start' and 'rows' parameters.
If you simply want them all, then it's much better still to use a bulk download that some sites offer, such as data.gov.uk, which supplies it complete as a simple JSONL download: Meta-data for data.gov.uk datasets.