trying confluence rest api to read comments for given page - from below rest calls but its giving different result when add expand (_expandable) body.view
Total : comment for given ID (some page id) is 28
Request 1) able to get 25 in first and rest 3 with next link
Request 2) not able to get 25 in first call
Request 1:
/rest/api/content/ID/child/comment
Results:
{
results : [ from 1 to 25 ],
"start": 0,
"limit": 25,
"size": 25,
"_links": {
"self": "/rest/api/content/ID/child/comment?limit=25",
"next": "/rest/api/content/ID/child/comment?limit=25&start=25",
"base": "baseurl",
"context": ""
}
Request 2: only changed to add expand
/rest/api/content/ID/child/comment?expand=body.view
Results:
{
results : [ from 1 to 0],
"start": 0,
"limit": 25,
"size": 20,
"_links": {
"self": "/rest/api/content/ID/child/comment?limit=25",
"next": "***0/***rest/api/content/ID/child/comment?limit=25&start=25",
"base": "baseurl",
"context": ""
}
Any suggestion why ?
Related
i get data from API like demo:-
{draw: 0, records Total: 210, records Filtered: 210, data: [,…], input: []}
data: [,…]
draw: 0
input: []
records Filtered: 210
records Total: 210
I want to apply paggination on API data (grid view or list view)
How can i do that ?
Your json structure needs to look like this to apply pagination with ease.
Use current page, next page and last page to determine the next, current and remaining pages.
You can directly use the next link to get the data of the next page.
{
"meta": {
"page": {
"current-page": 2,
"per-page": 15,
"from": 16,
"to": 30,
"total": 50,
"last-page": 4
}
},
"links": {
"first": "http://localhost/api/v1/posts?page[number]=1&page[size]=15",
"prev": "http://localhost/api/v1/posts?page[number]=1&page[size]=15",
"next": "http://localhost/api/v1/posts?page[number]=3&page[size]=15",
"last": "http://localhost/api/v1/posts?page[number]=4&page[size]=15"
},
"data": [...]
}
I need summary information for length between waypoints and also the polylines of each section. The "return" parameter appears to gives me only one option (summary) or another (polyline). I want to achieve this by only one request to the Rounting API v8. Would be it possible?
You can combine multiple return parameters. The parameter to provide information about maneuvers is actions (or turnByTurnActions). In your case:
return=summary,polyline,actions
Below is full routing request taken from HERE Maps for JavaScript API example:
https://router.hereapi.com/v8/routes?apikey=YOUR_API_KEY&routingMode=fast&transportMode=car&origin=52.5160%2C13.3779&destination=52.5206%2C13.3862&return=polyline%2Cactions%2CtravelSummary%2Ctinstructions
Response example:
routes": [
{
"id": "ccaa74a9-d866-465b-ac8c-2846cfeaaff0",
"sections": [
{
"id": "dffa50af-9e71-4585-b504-fdcd808d098e",
"type": "vehicle",
"actions": [
{
"action": "depart",
"duration": 32,
"length": 85,
"instruction": "Head southeast on Pariser Platz. Go for 85 m.",
"offset": 0
},
...
today, I found GET/estimates/price end point have a change, surge_multiplier disappeared, is to say, price has been fixed, no more surge?
Surging is based on the particular location and product setup - so if you try following request for example:
https://sandbox-api.uber.com//v1.2/estimates/price?start_latitude=-33.865535736083984&start_longitude=151.1958770751953&end_latitude=-33.88345718383789&end_longitude=151.0906982421875
"prices": [
{
"localized_display_name": "uberX",
"distance": 7.76,
"display_name": "uberX",
"product_id": "2d1d002b-d4d0-4411-98e1-673b244878b2",
"high_estimate": 35,
"surge_multiplier": 1,
"minimum": 9,
"low_estimate": 26,
"duration": 1260,
"estimate": "A$26-35",
"currency_code": "AUD"
},
If you try it for different location:
start_latitude=37.7752315&start_longitude=-122.418075&end_latitude=37.7752415&end_longitude=-122.518075
You will get response without 'surge_multiplier' parameter:
{
"localized_display_name": "uberXL",
"distance": 6.62,
"display_name": "uberXL",
"product_id": "821415d8-3bd5-4e27-9604-194e4359a449",
"high_estimate": 28,
"low_estimate": 22,
"duration": 1380,
"estimate": "$22-28",
"currency_code": "USD"
},
For more info on surging please read our documetation
EDIT done on 02/15/2018:
If you are using v1.2 request - response we are getting is based on the product setup. If the product used in the estimate request is configured to have "upfront_fare_enabled": true then we will get one fare_id - instead of estimate. So this is expected as in v1.2 with upfront_fare_enabled: true there will never be surge information (as you get a real fare + fare_id).
Please check following sentence from our documentation on "POST /v1.2/requests/estimate" endpoint:
You should use this endpoint to get an upfront fare before requesting
a ride. In some products upfront fares are not enabled so you can use
this endpoint to determine if surge pricing is in effect for the
product/location. Do this before attempting to make a ride request so
that you can preemptively have a user confirm surge by sending them to
the surge_confirmation_href provided in the response. This endpoint
will either return an upfront fare (in the fare key) or a range
estimate (in the estimate key) depending on the configuration of the
product.
So the response you are getting back depends on product configuration specifically: "upfront_fare_enabled" field. If there is upfront fare setup (upfront_fare_enabled = true) then there will not be "surge_confirmation_href" available in the response - and response type will be one "fare": {} response - example of this is below:
{
"fare": {
"value": 5.73,
"fare_id": "d30e732b8bba22c9cdc10513ee86380087cb4a6f89e37ad21ba2a39f3a1ba960",
"expires_at": 1476953293,
"display": "$5.73",
"currency_code": "USD",
"breakdown": [
{
"type": "promotion",
"value": -2.00,
"name": "Promotion"
},
{
"type": "base_fare",
"notice": "Fares are slightly higher due to increased demand",
"value": 7.73,
"name": "Base Fare"
}
]
},
"trip": {
"distance_unit": "mile",
"duration_estimate": 540,
"distance_estimate": 2.39
},
"pickup_estimate": 2
}
As you can see there is no "surge_confirmation_href" available.
If your product has "upfront_fare_enabled": false you will get estimate response with surge_confirmation_id and surge_confirmation_href as shown below:
{
"estimate": {
"surge_confirmation_href": "https:\/\/api.uber.com\/v1\/surge-confirmations\/7d604f5e",
"high_estimate": 11,
"surge_confirmation_id": "7d604f5e",
"minimum": 5,
"low_estimate": 8,
"fare_breakdown": [
{
"low_amount": 1.25,
"high_amount": 1.25,
"display_amount": "1.25",
"display_name": "Base Fare"
},
{
"low_amount": 1.92,
"high_amount": 2.57,
"display_amount": "1.92-2.57",
"display_name": "Distance"
},
{
"low_amount": 2.50,
"high_amount": 3.50,
"display_amount": "2.50-3.50",
"display_name": "Surge x1.5"
},
{
"low_amount": 1.25,
"high_amount": 1.25,
"display_amount": "1.25",
"display_name": "Booking Fee"
},
{
"low_amount": 1.36,
"high_amount": 1.81,
"display_amount": "1.36-1.81",
"display_name": "Time"
}
],
"surge_multiplier": 1.5,
"display": "$8-11",
"currency_code": "USD"
},
"trip": {
"distance_unit": "mile",
"duration_estimate": 480,
"distance_estimate": 1.95
},
"pickup_estimate": 2
}
And finally, if you update the product to have "surge_multiplier" > 1 and product have "upfront_fare_enabled = true" you will get "fare" response - but you will not know that surging is in place - until you do ride request. In this case, you will get the response with: "status": 409 and "title": "Surge pricing is currently in effect for this product." and "surge_confirmation" info that contains "href": "https://sandbox-api.uber.com/surge-confirmations/ride_request_id". So in order to complete your ride request - you need to redirect your user to that URL - and user needs to confirm surging. After that, you will be able to create new ride request.
resposne->
{
"meta": {
"surge_confirmation": {
"href": "https://sandbox-api.uber.com/surge-confirmations/48165d0e-f2f4-457d-98d0-058a31b15cd7",
"expires_at": 1510684778,
"multiplier": 1.2,
"surge_confirmation_id": "48165d0e-f2f4-457d-98d0-058a31b15cd7"
}
},
"errors": [
{
"status": 409,
"code": "surge",
"title": "Surge pricing is currently in effect for this product."
}
]
}
I'm currently calling the facebook me/home edge to get the users home feed. In the results I might get an entry like the JSON posted below.
My question is, when I get an entry like that where the user's friend ".. likes a link." How do I find out what link they liked? I'm trying to get the title and URL, but can't seem to figure out how. I've try just about every option using facebook's graph explorer.
Ideally, I would like that information to be returned when I made the /me/home request. I tried adding "attachments" to the fields parameter, but that didn't work.
{
actions=({
link="https://www.facebook.com/10154950234790111/posts/323892414481111";name=Comment;
});
comments={
};
"created_time"="2015-01-02T23:18:16+0000";from={
id=10154950234790453;name="Brian Joe";
};
id="10154950234790453_3238924144862222";
likes={
};
privacy={
value="";
};
story="Brian Joe likes a link.";
"story_tags"={
0=({
id=10154950234790111;
length=14;
name="Brian Joe";
offset=0;
type=user;
});
};
type=status;
"updated_time"="2015-01-02T23:18:16+0000";
}
This is a long standing bug in Facebook, probably older than two years.
https://developers.facebook.com/bugs/648986871793611/
https://developers.facebook.com/bugs/522743067756848/
I and many others have given up trying to repro this for Facebook Support.
You can give it a go if you want by reporting it to https://developers.facebook.com/bugs
Ideally Facebook should be inserting the object target in the story_tags like this
{
"story": "phwd likes Moët & Chandon.",
"story_tags": {
"0": [
{
"id": "13608786",
"name": "phwd",
"offset": 0,
"length": 17,
"type": "user"
}
],
"24": [
{
"id": "38995979792",
"name": "Moët & Chandon",
"offset": 24,
"length": 14,
"type": "page"
}
]
},
"id": "13608786_10101895322580287",
"created_time": "2015-01-03T17:35:51+0000"
},
Where this object
"24": [
{
"id": "38995979792",
"name": "Moët & Chandon",
"offset": 24,
"length": 14,
"type": "page"
}
]
Would instead be something like
"24": [
{
"id": "event_id",
"name": "Name of event",
"offset": 24,
"length": 14,
"type": "event"
}
]
So it ends up really being a feature request.
When I get a certain status in "/{status id}" api call, I get the message stripped from the mentions. How can I read the mentions?
Thanks
the field message_tags will give an array of mentioned users/pages in that post
Example:
"message_tags": {
"13": [
{
"id": "92689703737",
"name": "Tumblr",
"type": "page",
"offset": 13,
"length": 6
}
]
}