PDA

View Full Version : Should I use a Frontend Application or call the Library directly?


pjclas
10-23-2014, 07:03 PM
So hopefully I can explain this well enough...

I am programmatically generating a thread and from what I can see I can do this in two ways:

Call the API interface to add text content - I thought this would be the right approach, but it required a session and did a bunch of session validation I didn't want or need.

Call the Library directly - This seems to avoid most of the need for a session until the afterAdd() method is called which eventually calls validate() when generating a route (while attempting to send moderator emails). The validate again requires a session.


So either way it appears that I have to generate a session (which I did using vB_Session_Cli), but I'd rather not have to create a session if I don't need to.

However, my question ultimately becomes, if I have to create a session in either case, which method would be considered the more "correct" method to creating a thread programmatically. I guess I would lean toward the first method since it performs a lot more verification. However, if I don't need that verification then it just adds unnecessary overhead... I did see a comment in content.php indicating in order to avoid hvinput validation, call the library directly instead, which is what led me down that path.

Any thoughts on this?

Also, this is a bit more tedious then it used to be to create a thread using the datamanager in vb4... so maybe I'm missing something even easier?

DisasterDotCom
10-25-2014, 12:35 AM
Here's what vBulletin says (from what I can tell).

They enhanced the API in vb5 thinking that it was the better approach to enhance the software. However, certain parts of the company have been saying that they need to bring back a more robust plugin system at some point. So... I'm pretty sure they would tell you to go the API route at this point.

Dead Eddie
10-25-2014, 11:40 AM
Use the API. It's how the software internally posts content.

Here's an example of using it internally from a custom page.

https://vborg.vbsupport.ru/showpost.php?p=2513307&postcount=5

Max Taxable
10-25-2014, 05:07 PM
I tried to call my local library directly. They have a computer answering their calls, almost impossible to talk to a actual person.:D