How to get reviews history - api

I'm using the Upsource API to get the revisions and reviews.
Does anyone know which method to use to get the reviews summary?
Review Summary
I've tried getReviewSummaryChanges, getReviewSummaryDiscussions, but I didn't get what I needed.
Thank you

You can try other methods as described in the documentation:
https://upsource.evolutiongaming.com/~api_doc/reference/index.html
Try POST with "getFeed" method to get complete set of changes happening to a review : including "addedRevisions":
https://upsource-host/~rpc/getFeed
{
"limit": 20,
"type": 2,
"projectId":"myproject",
"reviewId":"MYPROJECT-CR-123"
}

Related

Get ratings for an item via API - Podio

I'd like to get information about a rating (fivestars) of one of an app item.
I've tried to do it using two requests:
/rating/item/1********9
and
/item/1********9?mark_as_viewed=false
Both via https://developers.podio.com/.
I'm receiving only the response (related to ratings):
"ratings":{
"like":{
"average":null,
"counts":{
"1":{
"total":0,
"users":[
]
}
}
}
},
In the GUI I can see my vote (3 stars).
Could you please help me with how I could get the rating?
Thanks for your help!
Adding a star rating to a Podio app is actually creating a Voting object (I know it's not very intuitive). I believe the endpoint you're looking for is Get result of voting on an item.

INVALID_ARGUMENT exception when requesting Google's knowledge graph API

I've read the documentation on Google's knowledge graph and from what I understand we can search for results both based on a query and based on IDs. For getting results by a query, no problem whatsoever, but when I try to retrieve them by IDs, it fails. Setting aside what query I used myself, this is the request URL I got from Google's API Explorer:
https://kgsearch.googleapis.com/v1/entities:search?ids=kg%3A%2Fm%2F01nrz4&key={YOUR_API_KEY}
and the result is:
{
"error": {
"code": 400,
"message": "Request contains an invalid argument.",
"status": "INVALID_ARGUMENT"
}
}
And I'm pretty sure that the problem is with the ids parameter. Am I missing something?
Thanks
OK, so here's the thing. Each found instance has an attribute like this: "#id": "kg:/m/0gkg6" . So in this instance the id is kg:/m/0gkg6, but when we want to run a query based on ID, we should omit the kg: part.

Should single items be paginated in a RESTful API?

Discussion at work has become quite divisive.
I request a collection from /books
{
"offset": 0,
"limit": 10,
"total": 3,
"results": [
{
"id" : 1,
"title" : "Book 1"
},
{
"id" : 2,
"title" : "Book 2"
},
{
"id" : 3,
"title" : "Book 3"
}
]
}
This is paginated.
Now if I request to books/<id> for a specific resource, should this be wrapped in a pagination results block too?
Some think that everything should be paginated but some think that a request to a unique item should respond with that and just that. So...
{
"id" : 1,
"title" : "Book 1"
}
This makes the most sense to me, as you're not requesting a collection you're requesting that specific item, why would a single resource need to be paginated?
I can understand this for the sake of consistency for the clients but I just want other opinions as I understand there's no right implementation of this obviously.
Thanks in advance,
Looking forward to everyone's points :)
We've all been there :), thanks to standards, things are much more consistent and cleaner of course. i personally apply the jsonapi.org v1.0 standard, which helped me a lot to make my restful services "standardized".
to answer your question, i think, if you are requesting one entity, well.. wrapping it with pagination is an extra work and you will not use it. the way i see it, is that you asked the restfull server to return only one entity, so why returning the pages, you dont need them, you requested one entity, you are aware of it! you should handle it. programming logic, only return/use what you need, unless you have an exception. ( and that another issue, re-factor your app architecture ).
hope this helps :)
I second the answer. Don't return the pagination for the single entity. The structure can imply as much meaning as the result itself. It may be important to note that the list itself returned only a single result - hence pagination vs. requesting a single result and getting exactly that one back.
Too many times I have seen in the past where bugs crop up where it's difficult to discern because of these 'optimizations'. Stick to your strong API definitions and it will pay dividends in not wasting hours debugging.

Yodlee Rest APIs and all possible responses

I am looking for a more detailed list of possible API responses when using Yodlee's REST API. Think of it as an XSD response but for a JSON string. I want to know if there are possible data elements that are not listed Yodlee's JSON response examples.
The only info I can really find so far is here.
When I review these examples, it appears that the example JSON responses do not fully describe every field.
Here is part of the getItemSummaryForItem1 JSON example for maturityDate element
"maturityDate":{
},
It looks like there is an array, but the possible data elements for that maturityDate array are undeclared. Then later on maturityDate is shown to be:
"maturityDate":{
"date":"0014-02-01T00:00:00-0800",
"localFormat":"dd/MM/yyyy"
},
And then in another example from getUserTransactionCategories
{
"categoryId":31,
"categoryName":"Retirement Income",
"transactionCategoryTypeId":2,
"isBudgetable":1,
"localizedCategoryName":"Retirement Income",
"isHidden":false,
"categoryLevelId":3
},
Based on that I would think all possible data elements are there.
But then there is another one which introduces the childCategory data element
{
"categoryId":2,
"categoryName":"Automotive Expenses",
"isDeleted":0,
"transactionCategoryTypeId":4,
"isBudgetable":1,
"localizedCategoryName":"Automotive Expenses",
"isHidden":false,
"categoryLevelId":3,
"childCategory":[
{
"categoryId":5641,
"categoryName":"1_SubCategory1",
"categoryDescription":"Subcategory desc1",
"isDeleted":0,
"isBudgetable":0,
"localizedCategoryName":"1_SubCategory1",
"isHidden":false,
"parentCategoryId":2,
"categoryLevelId":4
}
}
Thanks!
Yodlee team is working on to get this details documented, this is a time taking process and will be soon available over their portal. Meanwhile, is there any specific field or API response for which you are looking to get all the child elements which will help you out without blocking your integration?

Instagram API error

I using Instagram API to get user info
api = InstagramAPI(access_token=access_token)
profile = api.user(user_id="kallaucyahoocojp") # I try to put output data to profile variable here
And I get the below error:
DownloadError: Unable to fetch URL: https://api.instagram.com/v1/users/kallaucyahoocojp.json?access_token=(u'1191812153.f78cd79.d2d99595c79d4c23a7994d85ea0d412c', {u'username': u'kallaucyahoocojp', u'bio': u'\u30c4\u30a4\u30c3\u30bf\u30d5\u30a9\u30ed\u30ef\u30fc\u5897\u52a0\u30b5\u30fc\u30d3\u30b9', u'website': u'http://twitter\u30d5\u30a9\u30ed\u30ef\u30fc.jp', u'profile_picture': u'http://images.ak.instagram.com/profiles/anonymousUser.jpg', u'full_name': u'Kallauc', u'id': u'1191812153'})
Can anybody help me to fix it?
You need to pass the numeric-based user id, rather than the username. For example, instead of passing kallaucyahoocojp, you might pass 1234 if t
Here's how to get the ID if you don't have it:
Search for the instagram user id using this endpoint. In the python api:
api.user_search(q="kallaucyahoocojp", count=100)
Check the results for an exact string match on each user name while iterating through the results (calling .lower() to be sure to ignore potential case issues).
If you don't find the user in the first page of results, call to the next page using the max id returned.
Get the user id object from the returned from the matching users search result, then call your original function again with the numeric id.
A couple of very important notes:
Notice that I called the search function for users with a count of 100. You can pick any number, but contrary to other SO posts, the first user is not always the user you want in a search. The search can and will match partials, and not always according to an exact match first. How do I know? I have production instagram apps. I will qualify and say that usually the results are in the first 2-3 matches. Decide what is cheaper; repeated API calls that bring you closer to the limit, or 1 large bulk call where you are certain to get all the results.
The python Instagram API last I checked does a terrible job returning paging information. You actually get the paging URL which defeats the purpose of the python API itself to get additional pages. Your options are extract the next id parameter from the URL using urlparse or something similar, or fix the API to return the paging data as an object per the json (I've done both). What happens is the API itself is discarding part of the json and only giving you the URL which normally you don't want/need.
In your example, here's the search response:
{
"meta": {
"code": 200
},
"data": [
{
"username": "kallaucyahoocojp",
"bio": "ツイッタフォロワー増加サービス",
"website": "http://twitterフォロワー.jp",
"profile_picture": "http://images.ak.instagram.com/profiles/anonymousUser.jpg",
"full_name": "Kallauc",
"id": "1191812153"
}
]
}
Revising your call:
api = InstagramAPI(access_token=access_token)
profile = api.user(user_id="1191812153")
I should note that you may not need to call the user call if you did a search because you may simply have all the info you need. It will depend on what you are doing of course, so I am giving you the general method to use the rest of the user api.
For extracting profile info using Instagram API, userid is required.
The endpoint for extracting userID:
https://api.instagram.com/v1/users/search?q=[username]&access_token=[HERE]
The endpoint for extracting profile info:
https://api.instagram.com/v1/users/[userid]/?access_token=[HERE]
Note that before extracting information, check the login permissions for your access token.