How to filter items updated since a specific date in podio - podio

I am trying to retrieve all items from my Podio app that were updated since a specific date.
I tried the https://api.podio.com/item/app/{id}/filter API filtering on the last_event_on attribute but the API returns "error_description": "Invalid value \"last_event_on\" (string): Invalid filtering key"
How can I achieve this ?
I could create a View with updated items since Yesterday and call the API /item/app/{app_id}/filter/{view_id}/ everyday but it does not seem robust. I would rather pass specificaly the date of my last call to the API.
Nicolas

Found the solution within the documentation.
The available filters are listed within the View doc and not the filter one : https://developers.podio.com/doc/filters
Filter using the last_edit_on key which differs from the last_event_onin the response.
{
"filters":{
"last_edit_on": {
"from": "2017-07-10 18:27:03"
}
}
}

Related

How to limit Podio API output for complex item resources

Is it possible to limit API response from the POST /item/app/{app_id}/filter/ for a complex resources with a lot of fields set? I know there is fields param and it can be used with some predefined views, like items.view(micro), but this is not a solution for us. We need to explicitly define which fields should be returned, to have in the response only needed fields (optimize the output length as much as possible, but have all needed fields). Can we somehow achieve this by available for now API params or could Podio consider to introduce such functionality in the future API revisions?
You can specify the fields() decorator, to add desired fields to your view.
items.view(micro).fields(fields,created_on,last_edit_on)
Unfortunately I don't think it is possible to further filter the number of Podio Application's Fields returned under the REST response's fields field (ugh 😓).
I couldn't find a way to filter on the Fields defined by the user on the Application.
E.g.
[
{
"fields": [
{
"label": "My item field"
"field_id": 123456778,
"external_id": "my-item-field"
}
]
}
]
It's not possible to filter by my-item-field.
As I know, Rest Api doesn't allow you to limit (select) output fields. (As GraphQL can do)
So, while Podio is on Rest Api - you can't do that.

How to transform record value before update? - Update API expects a different format than fetch API

I have setup react-admin with Hasura (GraphQL API on Postgres) using the ra-data-hasura provider and I ran into an error when trying to update a record in an existing table.
I have this field tags with type varchar[] which is delivered by the fetch API in the format: tags: ["A", "B"], but the problem is that the UPDATE API expects the format tags: "{A,B}".
Therefore all UPDATE requests will fail.
I already tried the parse() and format() functions on the InputField, but they are not changing the initial value of the record. The update will still fail if the tags field is left untouched.
This is the API's (Hasura) error message in response to the UPDATE request. (just putting it here so other people might find this post)
{
"path": "$.args.$set",
"error": "A string is expected for type : _varchar",
"code": "parse-failed"
}
Is there a way to transform the value for tags in react-admin without having to modify the API?
You can decorate the Data Provider similarly to the example:
https://marmelab.com/react-admin/DataProviders.html#decorating-your-data-provider-example-of-file-upload

How to filter group members in Microsoft graph API?

I was sure about after reading Microsoft document that I can filter the group members using OData Query Parameters because https://developer.microsoft.com/en-us/graph/docs/api-reference/v1.0/api/group_list_members
Request GET URL - https://graph.microsoft.com/v1.0/groups/{groupId}/members?filter= startswith(givenname,'V')
In above URL groupId is used from https://graph.microsoft.com/v1.0/groups
but when I try to get the result using Graph Explorer (https://developer.microsoft.com/en-us/graph/graph-explorer) using my work account login, it's not working.
Also I have tried to use this in SDK (I have implemented graph API in my code using Microsoft graph API SDK) and still got same error.
And gives below error -
{
"error": {
"code": "Request_UnsupportedQuery",
"message": "The specified filter to the reference property query is currently not supported.",
"innerError": {
"request-id": "96f3ffef-56f5-42e3-82f2-64813106b729",
"date": "2018-02-13T10:59:39"
}
}
}
Is this because "members" is not a resource type ? so it does not have properties and so we can not filter this result ?
If so then is there any other way we can get filtered group members ?
Also posted issue on Github - https://github.com/microsoftgraph/microsoft-graph-docs/issues/2239
Add ConsistencyLevel: eventual to Your request header (should work for v1.0 and beta as well)
Filtering of group members is now available as a beta API.
GET https://graph.microsoft.com/beta/groups/{id}/members?$count=true&$filter=startswith(displayName, 'a')
Here's how you would impelment it in code
//testing the filter query here
// Get groups user is a member of
// GET /me/memberOf
var myfilteredUserGroups = await _graphClient.Me.MemberOf
.Request(queryOptions)
.Header("ConsistencyLevel", "eventual")
.Filter("startswith(displayName, 'sa')")
.Select("displayName,groupTypes,id")
.Top(GraphConstants.PageSize)
.GetAsync();
// This method casts the returned DirectoryObjects
// as Group object, and filters out any non-Group objects
model.MyFilteredGroups = await GetAllPagesAsType<Group>(
_graphClient, myfilteredUserGroups);
return View(model);

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.