Retrieving image files from referenced items in filtered items - podio

Being new to REST APIs (and APIs in general), I ran into some problems while trying to retrieve some Podio data using the Klipfolio web service, where I want to setup a simple dashboard with a list containing a name field from collected Podio and a image field from a reference field from the collected items.
So far I was led in the direction of 'bundling' and 'nesting', but I am not quite sure if this is the way forward.
In order to retrieve the filtered items, I have used the following POST method:
POST /item/app/11821547/filter/
Body:
{
"from": -1mr,
"to": -0mr
}
And then, from the items I here retrieve, I want to GET the referenced items, for instance using:
GET /reference/{ref_type}/{ref_id}
And finally, I want to get the image URL from the respective field in these referenced items, for instance using:
GET /item/{item_id}/value/{field_id}
Any help is much appreciated!!

To accomplish this you only need to use one API call to the Podio filter items endpoint in which you wrote above; POST /item/app/11821547/filter/.
In your POST body, you can filter down your results with the created to and from dates. For example, if you only want the items for the past month, you can use Klipfolio's date parameters. Your POST body will look like this:
{
"filters": {
"created_on": {
"from": "{date.addMonths(-1).format()}",
"to": "{date.today}"
}
}
}
This will return an API reponse of all items that were created within the past month. From here you can build a klip and manipulate the JSON with xpath expressions to extract the image urls and names. All this information will be within the #item/fields array in your API response. You'll have to determine which field ID is used for the name and image url field. These are unique to each account.
An example of xpath to extract these values would be like so:
#/items/fields[field_id='id_number']/values/value
Where id_number is the exact id number for the field.
If you are unfamiliar with xpath expressions within Klipfolio, here is a document that walks through this.

Related

Acumatica - Filter Generic Inquiry via REST

Trying to use this Generic Inquiry's REST API, I am able to retrieve all records though would like to filter them.
Can retrieve all data with PUT {{baseUrl}}/RawDataForReport?$expand=Result with an empty body request.
When I added a field Period to filter it's only showing the first row.
An empty request body also shows the first row when I added Period.
I am not at all familiar Acumatica any useful resources would be greatly appreciated.
To filter the Generic Inquiry result with REST API you need to add the filtering parameter to the GI itself. For instancce, you have your period filter defined in the Generic Inquiry. You can define more filters the same way.
You can learn about designing GIs here: https://openuni.acumatica.com/courses/reporting/s130-inquiries-reports-and-dashboards/
Another option would be to use OData instead of REST API. in that case you would be able to use $filter parameter to filter data.
You can read more about it here:
https://help-2020r2.acumatica.com/Help?ScreenId=ShowWiki&pageid=36beb9aa-f04d-4f63-a93b-a00b1c315be0
https://help-2020r2.acumatica.com/Help?ScreenId=ShowWiki&pageid=5d97a93d-45e0-466e-ba5e-77e1ccf96643
I've been struggling to find a solution to the same problem.
I just figured it out with the help of this stack overflow post.
Acumatica run Generic Inquiry via REST API
Take a look at the last response (not the accepted answer).
Basically when you define your object in the Web Service Endpoint screen, you can define the filters (Use Populate -> Filters). these are the Parameters for the GI.
You define the results the same as you have it.
Then in your PUT request body pass the parameters.
Example:
{
"Param1": {
"Value": "Value1"
},
"Param2": {
"Value": "Value2"
}
I just tested this with Postman, and it works well.

How to filter with "_links" properties params on API.v3 in openproject

I just learned to use "hypermedia rest API" on openproject
I want to use "filter" param with "_links" properties on API but not know-how
Example:
http:/<my_domain>/target/api/v3/projects/design/work_packages?filters=[{"updatedAt":{"operator":"<>d","values":["2017-06-10T22:00:00Z","2017-07-05T22:00:00Z"]}, "_links":{"type":{"title":{"operator":"=","values":["Box"]}}}]
==> My Question:
i not known use to "_links":{"type":{"title":{"operator":"=","values":["Box"]} params filter. Now, result is not filter for "_links"
And show me books name to learn API for to beginner
? (https://www.oreilly.com/library/view/restful-web-clients/9781491921890/ch04.html#callout_hal_clients_CO1-1) -> is this ok?
Help me, please!
Thanks!
Image for my api
What I understood you wanting to achieve is getting all work packages in the project "design" that have been updated last within a certain time interval and that are of the type "Box".
The filters in OpenProject do not differentiate between native properties (like updatedAt) and linked resources (like type) when it comes to the structure of the filters. The syntax is always
{"<name of the filter>": {"operator": "<operator>": "values": [<list of values>]}}
When it comes to the filter values however, there is a difference. For linked resource the client is expected to use the id whereas native value like an integer, string or date is required for the native properties.
For your request the above requires the client to issue the following query:
GET http://domain/target/api/v3/projects/design/work_packages?filters=[{"updatedAt":{"operator":"<>d","values":["2017-06-10T22:00:00Z","2017-07-05T22:00:00Z"]}}, {"type":{"operator":"=", "values":["10"]}}]
I took the id of 10 for the type "Box" out of the screenshot you provided.
To get the filter values of all available filter you can call
POST http://domain/target/api/v3/queries/form
with a body of
{"name":"default","_links":{"project":{"href":"/api/v3/projects/design"}}}
The response will list all available filters in the _embedded/schema/_embedded/filtersSchema array.

Acumatica API. Fetch products

What endpoints are used to fetch from Acumatica product data. Theoretically it should be /entity/Default/18.200.001/StockItem, however there no info about assigned categories, attributes, complex product information
The Default endpoint provides the ability to get the following information from the Stock Items page
The main problem with this page is that Acumatica doesn't allow to request more than one array type detail at a time and as you can see on the screenshot almost all details are arrays. So you will have to request each one separately.
For example, you can get items with their Categories by sending the following GET request:
entity/Default/18.200.001/StockItem?$expand=Categories
but at the same time, it is a little tricky to get Attributes, because you will need to send a PUT request with InventoryID for getting Attributes of the Item:
Request: entity/Default/18.200.001/StockItem?$expand=Attributes
Body:
{
"InventoryID" : {
"value" : "AACOMPUT01"
}
}
If you need to be able to get other information from this page you will need to extend endpoint, entity and add additional Views and Fields.

How to retrieve Wikidata entry from Wikidata search results?

I make a Wikidata search request like this (autocomplete use case):
https://www.wikidata.org/w/api.php?action=wbsearchentities&format=json&language=en&type=item&continue=0&search=photog
And the service returns a JSON response thus
{
id: "Q11633",
url: "//www.wikidata.org/wiki/Q11633",
description: "art, science and practice of creating durable images by recording light or other electromagnetic radiation",
label: "photography"
}
But how do I look up to get retrieve the content?
I can only find a title search which does not recognize the Q parameter. It only recognizes titles.
https://en.wikipedia.org/w/api.php?action=query&prop=revisions&rvprop=content&format=json&titles=Photography
You want to use wbgetentities, another method of WikiData's extension to the MediaWiki API (WikiBase). In its most basic form, it looks like this:
api.php?action=wbgetentities&ids=Q11633
You probably want to reduce the size of the reply, by specifying what you what to know about the entity, using the props parameter.

why the Graph API - Searching( https://graph.facebook.com/search) only send me 25 results

Hi I working with the Graph API - Searching (https://graph.facebook.com/search) and every time send me only 25 results and want to know how I can get more of 25 and maybe filter by date.
I hope you can help me
Look at the Paging in the Graph API documentation. Are you sending the "limit" parameter in the request? It looks like it is defaulting to 25 if you don't pass it and you get a paging object in the response which contains request URLs for the next/previous pages and you can use those to easily query the pages and show them.
Sample "paging" object in the search response:
"paging": {
"previous": "https://graph.facebook.com/search?q=orange&access_token=<your_access_token>&limit=25&since=1333151997&__previous=1",
"next": "https://graph.facebook.com/search?q=orange&access_token=<your_access_token>&limit=25&until=1333151781"
}