Hello there,

I have two websites hosted on a machine, and I was asked to enable a feature on one website where I pull in 'events' from the other website. They do not want to duplicate work, and would like to poll the one website to gather all the events that are published, and make them available on the other website. In comes remote entity API.

I got remote entity api installed and setup on both client and server, but can't seem to find any documentation that shows how to tell the 'client' to poll the server and pull out all entities that it has (Without duplicating ones that exist already).

All the documentation shows you have to do it programatically, but doesn't go into detail how to do it. I tried finding a UI solution, and all I could come up with is EntityFieldQuery Views Backend, which also doesn't have good documentation to show you how to setup and remotely pull in fields from a remote entity.

Could somebody please help me get this setup so I can move along with my work?

Comments

jfurnas’s picture

I just noticed I placed this in the wrong section. Is it possible for it to be moved into the 'post installation' section of the forums, please?

WorldFallz’s picture

It might end up being a code solution-- but done! ;-)

Jaypan’s picture

It sounds like you are looking for a UI solution, but everything in your post seems to point to that module requiring a programming solution.

jfurnas’s picture

I don't NEED a UI solution, it would just be convenient. I wouldn't mind making a programming solution, if I could get some assistance with it. The documentation for all tools needed to use remote entity API are very lacking and uninformative. A UI solution would be ideal, as it would make it easier for others to use later, but if programming is required at least some direction on how to pull in entities from the remote site would be helpful.

None of the documentation anywhere ever addresses your 'services connections', your resources or anything, so I have no idea how or where the connection is made, and how you successfully poll the other site for information.

Jaypan’s picture

I've never used the module, so I can't really offer any help on it, but have you looked at the readme file in the module? Often more clear directions are given there.

WorldFallz’s picture

I haven't tried it yet, but I had bookmarked the following for this topic:

You don't provide any info about the source systems, but I use feeds for pulling in data from remote sources and it works great. There's connectors for just about every type of source you could think of (standard feeds, files, web services, db, etc).

jfurnas’s picture

Both sites are using entities, which is why I am trying to use remote entity. Feeds didn't give me the option of pulling out entities. Remote Entity API seems to be the only solution for what i'm trying to do, but the lack of information and documentation make it impossible to use.

I was able to get the connectors working, and using the 'test' that it came with, it pulls stuff in by clicking a button on the admin page, but as far as doing it programmatically, there is nothing i've been able to find that explains how to do it.

I am trying to pull the entities of a certain type from the source into the local copy, and save them as they are on the source, but due to lack of documentation and code examples, it's proving to be difficult.

WorldFallz’s picture

Feeds didn't give me the option of pulling out entities.

huh? I use feeds to pull entities across drupal sites all the time. If you mean non-drupal entities, then you'd have to have some type of web service, feed, or connector for the source site. Feeds can pull in whatever you make available on the source site.

jfurnas’s picture

This is how I have the system setup.

There is a content type called 'Event' on both locations. They both have the same exact fields and field names. What I am trying to do, is automatically (using cron or another scheduler), poll the source for it's 'Event' entity list, and update the local one with the same information that is on the source.

Feeds doesn't appear to do it automatically, and I found feeds_db, which requires you to do it by passing an SQL query when you create a node to do it, but there isn't a way to make feeds do it automatically, and poll only the fields from the source for the 'Event' entity that I setup already.

WorldFallz’s picture

Ah ok, this is EXACTLY what i do. On the source site setup views using views_datasource (json, xml, etc) or views_data_export (xls, csv, etc) to create a feed of the event content type with all the fields you want to transfer. Then, on the destination site configure a feeds importer to consume the source with the appropriate parser based on the type of feed you created on the source.

You'll want to limit the source feed to the same or slightly longer period as the target. For example, if you're updating the feed every day, I would configure the filters on the source feed to only grab 2 days worth of nodes. This will limit the amount of traffic/processing.

jfurnas’s picture

Hmm, I will give this a try.

Will this still allow me to make local viewable views on the source site? The events should still be accessible and working on the source site, I just want them to also be accessible from the other site.

WorldFallz’s picture

I'm not sure what you mean by "local viewable views" but this doesn't affect the source site at all. It just enables sharing content on both sites. You can then use that content in your views on both sites however you want.

jfurnas’s picture

Yes, you are correct. I misunderstood you.

I am using JSON. I installed the views_datasource module, as well as the feeds_jsonpath_parser, and the feeds module, now I just have to figure out how to use them all together to achieve what I want.

Playing around with it a bit, I can't seem to find out how to get it to do it automatically. The only way I can trigger the import is if I go to content>add content>Event and make a new event, and paste in the json output URL, and even then it throws errors with retrieving the feed.

WorldFallz’s picture

Feeds is one of those modules it can be tough to figure out how to use without docs/videos (there are a few-- i recommend them).

In order to do it automatically, you set the 'Attach to content type' setting to standalone form and 'Periodic import' to the desired interval at /admin/structure/feeds/{importer-machine-name}/settings. Then it will happen at the first cron to occur after the selected interval has passed.

jfurnas’s picture

I will check out some videos. I think something is wrong with the JSONPath module I am using, I am getting php errors in the error log from JSONPathParser module about array indexes being wrong.

WorldFallz’s picture

I haven't tried json-- i usually use csv and that works perfectly.