Jump to content
YPCrumble

Documenting the XMLRPC API and endpoints

Recommended Posts

Hi - I'm new to Revive Adserver, but really appreciate what you all are building. I'd love to get involved.

The first thing I'd like to do is help with the API setup and documentation. Is that something that would be desirable? I'm seeing quite a few unanswered questions about it and would love to contribute what I learn as I install it myself. 

Please bear with me - my first question is where could I contribute PR's to the documentation? I don't see anything on GitHub. 

In terms of the API, I've done the following and still receive this response when I navigate to http://localhost:8080/www/api/v2/xmlrpc/:

```
<methodResponse>
<fault>
<value>
<struct>
<member>
<name>faultCode</name>
<value>
<int>105</int>
</value>
</member>
<member>
<name>faultString</name>
<value>
<string>XML error: Invalid document end at line 1</string>
</value>
</member>
</struct>
</value>
</fault>
</methodResponse>
```
 
Here's what I did (pasting from my Dockerfile):
 
```
RUN apt-get install -y php5-fpm
RUN apt-get install -y php5-curl
RUN apt-get install -y php5-gd
RUN apt-get install -y php5-json
RUN apt-get install -y php5-mysql
RUN apt-get install -y php-pear
RUN apt-get install -y curl

RUN pear install XML_RPC2

```

I built the Revive server, created an advertiser, banner, zone, website all manually. No problems at all doing that.

Then I went into the InvocationTags plugin and enabled the "Allow XML-RPC Invocation Tag" setting.

After doing the above, I still get that error when I try to navigate to that endpoint.

Is there a next step to beginning to access the API? Thank you for any help!

Share this post


Link to post
Share on other sites

Hi @YPCrumble,

Thanks, I have added that XML-RPC API documentation is something that needs to be done to my TODO list: https://documentation.revive-adserver.com/display/DOCS/TODO

However, if you would like to have a go at documenting it, that would be great! Unfortunately, the does are not in a system that supports PRs, so, if you want to just do something in plain text, that would be a fine start, thanks.

The "Allow XML-RPC Invocation Tag" option is for a separate XML-RPC invocation tag type, and actually has nothing to do with the XML-RPC API. The endpoint you are going to is just a base URL, AFAIK - you probably need to generate a valid XML request that defines the API action you are looking to perform...

Share this post


Link to post
Share on other sites

Hey @andrewatfornax thanks for your note!

I am sure I am confusing these endpoints. I'm also happy to start documenting the API and sending you a text file (or markdown?) is fine.

> AFAIK - you probably need to generate a valid XML request that defines the API action you are looking to perform...

I'm looking into generating a valid XML request. As I get started, is there a particular part of the codebase you could point me to where the XML endpoints are written?

EDIT: I see that prime just mentioned /www/api/v2/xmlrpc/index.php - that's what I was looking for.

There I see what looks like routes for (what appears to be) endpoints like `ox.logon`. What would be helpful is an explanation of how one of these endpoints works. Once I get one, I'm sure the rest would be easy to grok. For instance, would I create an XML request to:

http://localhost:8080/www/api/v2/xmlrpc/ox.logon ? (I doubt this is correct, but I think it explains what I mean).

Edited by YPCrumble
Realized one of my questions had already been answered.

Share this post


Link to post
Share on other sites

Unfortunately, I have never actually once in my life used the API! Shameful, I know, but that stems from back in the really, really old days, when the product was commercially owned, and it just wasn't an area where I did any work. So, I'm unable to help at this stage, until I get a chance to dig into it!

Share this post


Link to post
Share on other sites

lib/xmlrpc/php/openads-xmlrpc.inc.php is the script used to call from php to get a XML-RPC ad

this is a sample from my current server....

<?php
 /* <!-- Revive Adserver XML-RPC Tag - Generated with Revive Adserver v4.1.3 -->  */
    //ini_set('include_path', '.:/usr/local/lib');
    require 'openads-xmlrpc.inc.php';

    if (!isset($OA_context)) $OA_context = array();

    $oaXmlRpc = new OA_XmlRpc('ads.mr.com', '/www/delivery/axmlrpc.php', 80, false, 15);
    $adArray = $oaXmlRpc->view('zone:1', 0, '', '', 0, $OA_context, '');

    echo $adArray['html'];
?>
 

so if you can mimic that class, you should be able to get and deliver an xml-rpc ad.

if you want to do management tasks you will need to utilize or reverse engineer the lib/xmlrpc/php/openads-api-xmlrpc.inc.php file.

there is java classes available as well...  https://github.com/revive-adserver/revive-adserver/tree/master/lib/xmlrpc

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×