Get list of new wiki pages using Confluence API - confluence

My goal is to retrieve the number of the new pages created each month in Confluence. I want to use Confluence API, but Get Content doesn't seem like it provides the type of customization that would allow for returning a list of new pages or the number of new pages "by creation date." Can anyone point me in the right direction?

Have a look at Advanced Searching using CQL, they even described your usecase :)
The keyword you need is the created parameter. So if you want to search for all content created within the last 4 weeks (created > now("-4w")), you can try the following query:
/rest/api/content/search?cql=created%20>%20now("-4w")
This should return something like this, where size is the value you've been looking for
{
"results": [{
...
}],
"start": 0,
"limit": 1000,
"size": 1,
"_links": {
...
}
}
You can check the accuracy by adding the &expand=history parameter and see the createdDate for each page.
Be careful with the limit of results (by default 25). You can prevent this by setting a limit yourself &limit=1000. If you use an expand parameter, there is a max limit for searching - kinda confusing...
This should be the query for your search to find max 1000 new pages created in the last 4 weeks:
/rest/api/content/search?cql=created%20>%20now("-4w")&limit=1000

Related

Flutter and google places API results

hope someone can help me with this.
I've managed to return search autocomplete results and for the most part everything is ok and results are almost restricted to the area but ocassionaly I get areas outside of the radius when non of the queried letters match the area.
However I want to apply restrictions to display results that are only in the specified area/radius. I've tried applying strictbounds parameter, but strictbounds combined with types : 'address' is just showing no results or single result. When I remove types the results automatically show only points of interest which I don't need. Only need addresses.
Anyone have any idea whats wrong in this?
Uri uri = Uri.https("maps.googleapis.com", "maps/api/place/autocomplete/json", {
"input": query,
"location": poznanLocation,
"language": "pl",
"radius": searchRadius,
"key": apiKey,
"bounds": "52.22,15.33|53.13,17.36",
"strictbounds": "true",
"types": "address",
"sessiontoken": _sessionToken,
});
Are you sure there are suitable results that should be returned?
Depending on the values of location and radius(*), there may be no suitable results left after adding both strictbounds and types=address.
If results are returned when removing strictbounds, are they strictly within the region defined by location and radius? If they are, please file a bug. Otherwise, that is precisely the intended behavior of strictbounds.
(*) The Place Autocomplete web service will ignore the bounds parameter, because it is not supported.

Dart/Flutter Typeahead for JSON API with indexed list

Can someone give me an example of how to use the typeahead to autofill a search field
and put it in the URL /$typedata/ where it calls an API and returns a JSON file that looks like the below? All of the examples I see are nice and neat with the booktitle: "Leaving";
author: "whoever";
publisher: "Phantom";
or there is a list with the variables already identified ["Leaving", "whoever", "Phantom"]
I can't figure out how to put all of these elements together. I need to extract the "compound: []
up to six variables.
It's several different pieces and I'm new. I can't seem to get past the compound with mutliple variables. I know I need an index and to call the index by number but I can't seem to get it all together.
Any help is appreciated.
{
"status": {
"code": 0
},
"total": 6,
"dictionary_terms": {
"compound": [
"aspirin",
"Aspirina",
"AspirinTest2",
"ASPIRIN (MART.)",
"ASPIRIN COMPONENT OF AXOTAL",
"ASPIRIN COMPONENT OF AZDONE"
]
}
}
btw: I'm new to this and I'm sure I'm missing something important. Thanks for any help!!!

Can you list multiple features within the same Schema.org "LocationFeatureSpecification"?

I am working on Schema.org Resort schema for a ton of resorts on a travel website and am trying to find the most efficient ways of filling out the schema with regards to amenities.
The current code looks something like this:
"amenityFeature": [
{
"#type":"http://schema.org/LocationFeatureSpecification",
"name":"Spa",
"value":"true"
},
{
"#type":"http://schema.org/LocationFeatureSpecification",
"name":"Internet Access",
"value":"true"
},
{
"#type":"http://schema.org/LocationFeatureSpecification",
"name":"Tennis Courts",
"value":"true"
}
]
My question is, can I write it like this instead to shorten lines of code:
{
"#type":"http://schema.org/LocationFeatureSpecification",
"name":[
"Spa", "Internet Access", "Tennis Courts"
],
"value":"true"
}
When I test it in Google’s Structured Data Testing Tool, it doesn’t give any errors. Here is what it looks like in the SDTT when I write it the short way:
And here is what it looks like if I do it the first/long way:
If I do it the short way, I want to make sure all those items are getting listed as amenities and not just different names for the same amenity. Otherwise, I'll go the long route.
No, each LocationFeatureSpecification represents one feature:
Specifies a location feature by providing a structured value representing a feature of an accommodation as a property-value pair of varying degrees of formality.
Your second snippet would represent one feature with multiple names.

Address an ordered list the RESTful way

I doubt what's the best way to address an ordered list in a RESTful API. Imagine the following example: Let's create a chart list of LPs, where you want to add new LPs, delete those which aren't in the TOP10 yet, and change their positions. How would you implement those methods in a RESTful JSON-API?
I thought of the following way:
GET / to return the ordered chart list like [{ "name": "1st-place LP", "link": "/uid123" }, { "name": "2nd-place LP", "link": "/uid987" }, ...]
GET /{uid} to return a LP by its unique ID, returning sth. like {"name": "1st-place LP", "ranking": 1 }
GET /ranking/{position} to access e.g. the current first-ranked LP, returning a 303 See Other with a Location-header like Location: /uid123
POST / with request body { "name": "my first LP title" } to create a new LP without specifying its current chart position
Now it's the question how we could change the current chart positions? One could simply PUT /{uid} to update the ranking attribute, but I think a PUT /ranking/{position} would be more natural. On the other hand it doesn't make sense to PUT against an URI which will return a 303 See Other when using GET.
What do you think would be the best way to address such a chart list? I don't like the solution of changing simply the ranking attribute in the LP-datasets as this could end in senseless states like two LPs with the same ranking and so on.
I see two questions. 1. What is the most RESTful (beautiful) way to design the API? 2. How do I make sure that two LPs does not get the same ranking?
1:
Your LPs could have several properties that are relative to eachother, e.g. different ranking on different charts. I would say that you want the ranking moved OUT of your LP resource. Keep the ranking on a certain list as a separate resource. Example:
GET /LPuid only returns properties about the LP, not relative properties, like rankings
GET /billboard/3 returns the URI to LP that has rankning 3 on the billboard list.
PUT /billboard takes a document of 100 LP URI's.
PUT /billboard/3 INSERTS an LP URI at that ranking and moves the other ones down.
2: That has nothing to do with rest and you would have that issue no matter how you design your API. Transactions is one solution.
You have two collection resources within your music service. As such, I would design a URI structure like this:
/ => returns links to collections (ergo itself a collection resource)
/releases => returns a list of LPs
/chart => returns the top 10 LPs, or redirects to the current chart URI
You would POST to /releases to add a new LP, and PUT or PATCH to /chart to define a new chart or alter the current chart. You will need to define what representation formats are transfered in each case.
This gives you the flexability to define thinks like /chart/2012-12-25 to show the chart as it stood on christmas day 2012.
I do not suggest using PUT /chart/{position} to insert an LP at a specific position and shuffle everything else down. Intermediarys would not know that a PUT to that URI causes other resources to change their URIs. This is bad for caching.
Also, as a user, I would hope you avoid the word "billboard" as the other answer suggests. A billboard conjures in the mind pictures of an advertising hoarding, and not anything to do with ranking charts!

Grails searchable plugin: limitless results

The searchable plugin seems to default to only 10 results. How do I change this to return all results?
# Bill
I'm looking for something like this:
DomainClass.search("This is the query", [max:every_last_one_of_em])
I could put a limit of like 40 and probably be fine, but the purpose of this search is to give a human a list of similar things to disambiguate, so if some of the things are missing the stupid humans will likely use "assumption" to get the wrong answers.
From the documentation at: http://grails.org/Searchable+Plugin+-+Methods+-+search
Options affecting the return value
max - The maximum number of results to return (default 10). Only used with result: "searchResult"
So it seems you'll need to pass in a Map of options to your search call, like:
DomainClass.search( "This is the query", [max:1000] )
Note, having an "unlimited" search result is a Bad Idea(TM). Figure out the max you want to handle and use that as your limit.
I would suggest having a "large" limit, if you must. If you get back that many, then do a further query to find out how many there are (there is an option for that too), and display a message to the user that "This is an incomplete set, please further restrict your view" or some such.
If you absolutely MUST show them all. Then use that count query (it's an option in the page I listed above), then resend the search using that count as the max.
Mikey to make the search return all results just remove the max field from the defaultMethodOptions.
You can find this declaration in Configuration -> Searchable.groovy
defaultMethodOptions = [
search: [reload: false, escape: true, offset: 0, max: 10, defaultOperator: "and"],
suggestQuery: [userFriendly: true]
]