How to use the 'query_fields' and 'query' options with Vimeo API? - vimeo

I'm trying to get my head around Vimeo API with Python. I'm successful in the sense that I can use basic API requests e.g. to list all my videos or similar.
Mostly, I use the /me/videos/ API endpoint. The API reference states, that there can be two options 'query_fields' and 'query'. If I just use 'query', I can filter the results e.g. by a string in the title. I'm assuming this works, because the default value for 'query_fields' is title,description,chapters,tags' according to the API reference.
But what i'd like to do is to use the 'query_fields' for something like:
'query_fields': 'privacy.view'
'query': 'unlisted'
But if I try that, a generic error message is returned
{
"error": "Searching for a page that does not exist or is too far back in our catalog to present.",
"link": null,
"developer_message": "The user's from + size exceeded 10,000, they requested a page of results that does not exist, or they issued an invalid query as defined in the QueryPreprocessorPlugin.",
"error_code": 2969
}
Has anyone been able to use the 'query_fields' option on any way other than the defautl fields?

You can't query any fields with query_fields, the only valid fields are the ones listed in the docs ('title', 'description', 'chapters', 'tags').
You'd need to manually filter on privacy.view, so i.e.
GET /me/videos?fields=uri,privacy.view
And loop through this filtering for the values you want.

Related

How to include SR related work log long description when using maximo oslc rest api?

I am doing an HTTP GET request to /maximo/oslc/os/mxsr and using the oslc.select query string parameter to choose:
*,doclinks{*},worklog{*},rel.commlog{*},rel.woactivity{*,rel.woactivity{*}}
This lets me get related data, including related worklogs, but the worklog does not include the 'description_longdescription' field.
The only way I seem to be able to get that field is if I do a separate HTTP GET to query a worklog id directly through /maxrest/rest/mbo/worklog . Then it provides the description_longdescription field.
I understand this field is stored separately through the linked longdescription table, but I was hoping to get the data through the "next gen" oslc api with one http get request.
I've tried putting in 'worklog{*,description_longdescription}', as I read somewhere that longdescription is a "non-persistent" field and must be explicitly named for inclusion, but it had no effect.
I figured out that for the /maximo/oslc/os/mxsr object in the API, I needed to reference the related MODIFYWORKLOG object through the rel.modifyworklog syntax in the oslc.select query string:
oslc.select=*,doclinks{*},rel.modifyworklog{*,description_longdescription},rel.commlog{*},rel.woactivity{*,rel.woactivity{*}}
I also had to explicitly name the non-persistent field description_longdescription for it to be included.
Ref. for the "rel." syntax: https://developer.ibm.com/static/site-id/155/maximodev/restguide/Maximo_Nextgen_REST_API.html#_querying_maximo_asset_management_by_using_the_rest_api

Wikipedia Mediawiki API get URL in query

Using the MediaWiki API I have a query that returns the results I want:
https://en.wikipedia.org/w/api.php?action=query&list=allpages&apfrom=Apple&aplimit=5
How can I modify it to also include the URL for each of the pages that are returned?
I tried adding the "info" property and "url" info, but it does not return additional information:
https://en.wikipedia.org/w/api.php?action=query&list=allpages&apfrom=Apple&aplimit=5&prop=info&inprop=url
You need to move the parameters you use to get the result to a generator instead of a list and then use prop=info and inprop=url in the query. Like this:
https://en.wikipedia.org/w/api.php?action=query&format=json&prop=info&generator=allpages&inprop=url&gapfrom=Apple&gaplimit=5

Get users for a given group Activiti Rest API

I'm looking for some advice on how to approach retrieving the users from a given group of the activti-app. Having read the documentation I've attempted to hit the endpoint associated with users and their groups by a posting a JSON body containing an array of user task filter ids.
Testing this in Postman returns a 500 internal server error "exception": "Request method 'POST' not supported". Obviously this is because I should be making a GET request however I cannot attach a JSON body in that case.
Aforementioned example endpoint: localhost:8080/activiti-app/api/enterprise/groups/{group_id}/users
Aforementioned docs:
https://docs.alfresco.com/activiti/docs/dev-guide/1.5.0/#_user_and_group_lists
Specifically this section Screencap of activti docs
Any suggestions would be greatly appreciated!
Thanks!
First, we have to make sure we are talking about "organization groups" not "capabilities groups". That was my original confusion. Once I create the right kind of group I could successfully use the REST API to fetch both a list of groups and a list of group members.
As the docs point out, to get a list of groups, do this:
curl -uadmin#app.activiti.com http://localhost:8080/activiti-app/api/enterprise/groups
Which returns:
{
"size":2,
"total":2,
"start":0,
"data":[
{"id":5,"name":"test-org-group-1","externalId":null,"status":"active","groups":null},
{"id":6,"name":"test-org-group-2","externalId":null,"status":"active","groups":null}
]
}
If you want to pass a filter, do it with "?filter=some-group-name".
Now, to see the members of a specific group, pass in the group ID, which is a numeric. So to see the members of test-org-group-1 I would use:
curl -uadmin#app.activiti.com http://localhost:8080/activiti-app/api/enterprise/groups/5/users
Which returns:
{
"size":2,
"total":2,
"start":0,
"data": [
{"id":2,"firstName":"Test","lastName":"User1","email":"tuser1#metaversant.com"},
{"id":3,"firstName":"Test","lastName":"User2","email":"tuser2#metaversant.com"}
]
}

How do I connect a django rest framework json query result to dgrid/OnDemandGrid

My JSON store (django rest framework) returns keys for "count", "next", "previous", and "results".
"count" is the number of rows available.
"next" is the url for the next page of results (e.g. ids 26-50).
"previous" is the url for the previous page of results (null in this case since this is the first page of results).
The "results" key contains the actual data objects I'd like to display in the OnDemandGrid.
How do I connect the "results" key data collection to the grid? Thank you for your help in advance.
The returned JSON ( collection: new Rest({target: '/api/events'?format=json'),}) ) looks like this:
{
"count":1411,
"next":"http://localhost/api/events/?format=json&page=2",
"previous":null,
"results": [
{"id":1,"event_type":"02","event_at":"2015-03-31T12:53:41Z","machine_id":1,"revs":4342,"color":5,"heads_info":"using http","tag":1,"hidden":false},
{"id":2,"event_type":"02","event_at":"2015-03-31T12:53:41Z","machine_id":1,"revs":4342,"color":5,"heads_info":"using http","tag":1,"hidden":false},
...
{"id":25,"event_type":"02","event_at":"2015-03-31T12:54:01Z","machine_id":1,"revs":4342,"color":5,"heads_info":"using http","tag":1,"hidden":false},
]
}
It looks like you're trying to use this service with dstore/Rest, but that has some specific expectations of the server request and response:
The response must report the list of items in one of the following ways:
Respond with a top-level array of items
Respond with an object with an items property whose value is an array of items
The response must report the total number of items in one of the following ways:
If the response is an object, you may include a total property in the object
Otherwise, you must include a Content-Range header (in the format X-Y/Z items, where the Z is of primary importance)
The request must support being informed of the range of items it should request out of the total result set via one of the following mechanisms:
start and count GET parameters (specified to the store instance via rangeStartParam and rangeCountParam)
Range headers (by setting useRangeHeaders: true)
Otherwise, by default, the store will pass a limit GET parameter in the format limit(count,start) (or just limit(count) if start is 0)
If your server can't fulfill these requirements (e.g. it sounds like it has quite different requirements regarding ranging, since it uses pages instead), you're going to need to think about extending/implementing a custom store.

Box API: Get_managed_users returning all users

Using the Box 1.0 REST API, I am trying to work with the functions in SOAP UI.
The API doc for get_managed_users with user_id=12345 (internal id retrieved with get_user_id call correctly) is returning all the users. The docs say that would be the case if you do not specify a user_id value. But my full command is: (Token and API key changed to protect the clueless)
https://www.box.com/api/1.0/rest?user_id=27360&auth_token=blahbalhblah1234&action=get_managed_users&api_key=someKeyYouShouldNotSee
Now I could work with the complete result list, but that won't scale as we get thousands of users into the system.
I can make a call with edit_managed_user, using the same user_id value and the change is reflected in the UI, and in the next get_managed_users call. Thus I do have the correct user_id value, I would so assume.
I tried testuser#gmail.com as the user_id value as well, and get the entire list back. This leads me to believe that somehow I am sending user_id wrong, but I just do not see it.
Any hints? Why, with what seems like a valid user_id value is it acting like it is absent or incorrect?
Most likely you have either called this method with an invalid user_id, or one that is not in your set of managed users. Can you double check that the user comes back in your list of already managed users?