Skip to content

Unable to get global data using the XML-RPC API #580

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
jorgemarti opened this issue Jul 1, 2021 · 6 comments
Open

Unable to get global data using the XML-RPC API #580

jorgemarti opened this issue Jul 1, 2021 · 6 comments
Assignees

Comments

@jorgemarti
Copy link

I have defined a series of schemas to store global data, and I'm trying to access data using the XML-RPC API using cURL.

I am able to get the schema definition with the following request:

<?xml version='1.0'?>
<methodCall>
  <methodName>plugin.struct.getSchema</methodName>
  <params>
    <param>
      <value>
        <string>firewallzones</string>
      </value>
    </param>
  </params>
</methodCall>

The response is as follows:

<?xml version="1.0"?>
<methodResponse>
  <params>
    <param>
      <value>
        <struct>
  <member><name>firewallzones</name><value><array><data>
  <value><struct>
  <member><name>name</name><value><string>name</string></value></member>
  <member><name>type</name><value><string>Text</string></value></member>
  <member><name>ismulti</name><value><boolean>0</boolean></value></member>
</struct></value>
  <value><struct>
  <member><name>name</name><value><string>purpose</string></value></member>
  <member><name>type</name><value><string>Text</string></value></member>
  <member><name>ismulti</name><value><boolean>0</boolean></value></member>
</struct></value>
</data></array></value></member>
</struct>
      </value>
    </param>
  </params>
</methodResponse>

However if I try to get the global data on that schema, I get a meaningless response:

Post data:

<?xml version='1.0'?>
<methodCall>
  <methodName>plugin.struct.getData</methodName>
  <params>
    <param>
      <value>
        <string>doku:admin</string>
      </value>
    </param>
    <param>
      <value>
        <string>firewallzones</string>
      </value>
    </param>
    <param>
      <value>
        <int>0</int>
      </value>
    </param>
  </params>
</methodCall>

Response:

<?xml version="1.0"?>
<methodResponse>
  <params>
    <param>
      <value>
        <struct>
  <member><name>firewallzones</name><value><struct>
  <member><name>name</name><value><string></string></value></member>
  <member><name>purpose</name><value><string></string></value></member>
</struct></value></member>
</struct>
      </value>
    </param>
  </params>
</methodResponse>

As you can see, no values are returned, only column names.

Probably not important, but all cURL calls are made as as follows:

curl -X POST https://myserver/lib/exe/xmlrpc.php -H "Content-Type: application/xml" -H "Accept: application/xml" -d "@postData.xml" --cookie cjar

Any ideas? Many thanks for your feedback.

@annda annda self-assigned this Mar 24, 2022
@sirtoobii
Copy link

As far as I can tell it is also not possible to write serial or global data with XML-RPC

@springfielddatarecovery

Would also like this feature

@ayebrx
Copy link

ayebrx commented Feb 12, 2025

To solve this problem, we can add a new function in remote.php that exposes the schema metadata and its entries along with the IDs

@smart-tech-master
Copy link

@jorgemarti
I would like to contribute to your project but the task description is not clear to me yet, would you contact me now?
telegram: https://t.me/smartbigdaddy
skype: live:.cid.6685adcfbab15764

Thanks

@serunkuma
Copy link

f411d87#r152655173

File AccessTable.php line 412 function getDataArray(). this function is not quite right.

its subquently being called in helper.php by the getData function on line 65.

this function is returning an Array of this kind:

`Array
(
[cars] => Array
(
[bodyType] =>
[color] =>
[tires] =>
[make] =>
[model] =>
[year] =>
)

)`
which is not what we are looking for. am really new to looking to this but an extra function in remote.php is not the answer. the sql built from query builder is.

in getDataArray function. there is this call: $data = $this->getDataFromDB(); which inturn calls [$sql, $opt] = $this->buildGetDataSQL($idColumn);

that builds the query that return the empty values. I might need some help understanding the querying mechanism so that I can make a substantial PR for this.
my tests after trying create new function in remote.php show me that its not the answer

@springfielddatarecovery

This PR fixes this issue:

#732

Example of how to get this data in python:

import dokuwiki
DOKUCONN=dokuwiki.DokuWiki(url='http://yoursite.com',user='username',password='yourpassword')
fetched_schema=DOKUCONN.structs.get_data('','yourschema')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants