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
    This one was a bit tricky to me. Finally solved my own problem(after trying every syntax I could imagine) and maanged to write to /objects/(type)/(objectid)/(version)/properties/(id):

    url = ''.join((baseurl,'/objects/184/54/-1/properties/1235')) #used this one to get
    posturl = ''.join((url,'.aspx?_method=PUT'))
    data = json.dumps({'PropertyDef':'1235', 'TypedValue':{'DataType':'13', 'Value': 'Some Text'}})
    newquery = requests.post(posturl, headers = headers,data = data)

    When accessing another resource such as /objects/(type)/(objectid)/(version)/title, all the mfws expects is json.dumps({"Value":somevalue}).
Reply
  • Former Member
    Former Member
    This one was a bit tricky to me. Finally solved my own problem(after trying every syntax I could imagine) and maanged to write to /objects/(type)/(objectid)/(version)/properties/(id):

    url = ''.join((baseurl,'/objects/184/54/-1/properties/1235')) #used this one to get
    posturl = ''.join((url,'.aspx?_method=PUT'))
    data = json.dumps({'PropertyDef':'1235', 'TypedValue':{'DataType':'13', 'Value': 'Some Text'}})
    newquery = requests.post(posturl, headers = headers,data = data)

    When accessing another resource such as /objects/(type)/(objectid)/(version)/title, all the mfws expects is json.dumps({"Value":somevalue}).
Children
No Data