Harvest from other Tainacan

Hi!! :smiley:

I’d like to ask if it is possible to harvest from other Tainacan.
I have a Tainacan working, and I want to harvest their items or the collection if it is possible.

Hi @bizzle, welcome to our forum!

The answer is yes, but not without coding. Because we have our own REST API, you can fetch public items and metadata from other Tainacans but for that you will have to build code that sets parameters such as collection and metadata IDs, so it is very customized for each scenario. If you have experience with programming or has some developer working with you we can provide some guidance.wiki

Yes, please!

Here is an example of a request to our Items API:

To read more about the possible parameters, check this:

And here is an example of a code in React + Axios doing a request to the items list:

These requests only include title, descriptions and thumbnails. I you would like to add custom metadata to the results, you should also pass a fetch_only_meta=123,456,789, where 123, 456 and 789 are the desired metadata IDs.

Ok, I got it, but in what part of Tainacan do I have to put that code to make the request? and maybe an example in PHP, or isn’t it possible?


Ok, I should give more context.

You should never touch the code of the plugin, it will be overrided on updates. I don’t know where and how are you planning to use the data that you fetch from another Tainacan but that should be in a plugin or theme. Do some search on how to scaffold a WordPress plugin, it should be easy.

While we do have an internal API that is build in PHP, you will not be able to use it to fetch items from outside your site. For that you will have to use the REST API. You can do the API calls in most languages, such as JavaScript, Python… the example that I gave is in a JavaScript framework known as React.

But if you want to do it directly via PHP you can do so using cURL: