This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

mfws and python

Former Member
Former Member
I'm currently starting a project to interact with mfiles using python.  I've managed to get authentication tokens with this code:

#testbed for requests (http api) and mfiles REST interface
import requests
import json
#try to retrieve authentication tokens
authentication = 'localhost/.../authenticationtokens.aspx'
data = json.dumps({"Username":"yourname", "Password":"yourpassword"})
h= requests.post(authentication, data = data)
print(h.reason,'reason')
print('#')
print(h._content)

Anyone interested in working on this jointly?

New discovery.  The data line must be changed to :

data = json.dumps({"Username":"yourname", "Password":"yourpassword",
                  "VaultGuid":"{1E5F2435-AFB8-4A7D-92D3-45B04D1268D9}"})

or the token won't work for individual vault access.

Parents
  • Former Member
    Former Member
    Adding this code to the above returns a string rep of the root window:

    baseurl ='http://localhost/m-files/REST'
    headers = {"content-type":"aplication/json",'X-Authentication':h.text[10:-2]}
    foobar = requests.get(''.join((baseurl,"/views/items.aspx")), headers = headers)
    print(foobar.text)
Reply
  • Former Member
    Former Member
    Adding this code to the above returns a string rep of the root window:

    baseurl ='http://localhost/m-files/REST'
    headers = {"content-type":"aplication/json",'X-Authentication':h.text[10:-2]}
    foobar = requests.get(''.join((baseurl,"/views/items.aspx")), headers = headers)
    print(foobar.text)
Children
No Data