Package: mercuryV1
mercuryV1API wrapper library in python for mercury CRM
for more information please visit the API reference on mercury's websitehere.InitialisationGet YOUR_ACCESS_KEY and YOUR_ACCESS_TOKEN from your mercury account (Admin > Integrations). If you wish to use sandbox mode, you will need to login with the UAT url, there is a different token for sandbox.from mercuryV1 import Mercury

client = Mercury(token='YOUR_ACCESS_TOKEN',key='YOUR_ACCESS_KEY',sandbox=True)Examplesfrom mercuryV1 import Mercury

# initialise the client
client = Mercury(token='YOUR_ACCESS_TOKEN', key='YOUR_ACCESS_KEY', sandbox=True)

# create a new contact with some person data
person = {"firstName": "Henry", "lastName":"Ford", "email":"henryford@ford.com"}
client.contacts.create(data=person)

# retrieve the entire list of contacts in mercury
client.contacts.get()

# retrieve a list of 30 contacts beginning from the 203rd contact
client.contacts.get(count=30, offset=203)

# search for opportunities that were modified after 13th March 2019 and sort them in last modified date, ascending order
searchOptions = {"lastUpdated":"2019-03-13"}
sortOptions = {"key":"lastModifiedDate", "order":"ASC"}
client.opportunities.get(search=searchOptions, sort=sortOptions)

# create a related party and link it between an opportunity and a contact
relatedPartyData = {"personID":"CONTACT_ID","relationship":"Father"}
client.relatedParties.create(data=relatedPartyData, parentId="OPPORTUNITY_ID")ContactsMethodsMethodReturnsclient.contacts.create(data={})dictclient.contacts.delete(id='')Response status codeclient.contacts.fetch(id='')listclient.contacts.get(count=100, offset=0, search={}, sort={})listclient.contacts.update(id='', data={})Response status codeContact Search OptionsOptionTypeDescriptionnamestringContact name to search forisDeletedbooleanSet to true if searching for deleted contactsexcludeDoNotMailbooleanExclude contacts marked as do not email from the search results.         If not set, will default to falseexcludeEmailBouncedbooleanExclude contacts with bounced emails from the search results.          If not passed, will default to falselastUpdatedstringReturns results after the given lastUpdated date. Date should be in yyyy-mm-dd formatcompanyNamestringCompany name of the personpersonTypestringThe relationship type of the personcategoryIdstringSearch by the category idcampaignIdstringSearch by the campaign idcontactNumberstringSearch by the contact number of the personemailstringSearch by the email address of the persondateOfBirthstringSearch by date of birth of the person. Date should be in yyyy-mm-dd formatbirthdaystringSearch by birthday anniversary. Date should be in yyyy-mm-dd formatcreatedOnstringSearch by creation date. Date should be in yyyy-mm-dd formatOpportunitiesMethodsMethodReturnsclient.opportunities.create(data={})dictclient.opportunities.delete(id='')Response status codeclient.opportunities.fetch(id='')listclient.opportunities.get(count=100, offset=0, search={}, sort={})listclient.opportunities.update(id='', data={})Response status codeOpportunity Search OptionsOptionTypeDescriptionnamestringOpportunity name to search forisDeletedbooleanSet to true if searching for deleted opportunitiesstatuseslistList of opportunity statuseslastUpdatedstringSearch by last updated date. Date should be in yyyy-mm-dd format.transactionTypestringThe type of transactionuserstringCA number of the agentcreatedOnstringSearch by created date. Date should be in yyyy-mm-dd format.confirmedSettlementDatestringSearch by settlement date. Date should be in yyyy-mm-dd format.interestOnlyExpirystringSearch by interest only expiry date. Date should be in yyyy-mm-dd format.fixedRateExpirystringSearch by fixed rate expiry date. Date should be in yyyy-mm-dd format.Contact and Opportunity Sort OptionsOptionTypeDescriptionkeystringcreationDate or lastModifiedDate. creationDate is defaultorderstringASC or DESC. DESC is defaultAddressesMethodsMethodReturnsclient.addresses.create(data={}, parentId='')dictclient.addresses.delete(parentId='', nestedId='')Response status codeclient.addresses.update(data={}, parentId='', nestedId='')Response status codeContact MethodsMethodsMethodReturnsclient.contactMethods.create(data={}, parentId='')dictclient.contactMethods.delete(parentId='', nestedId='')Response status codeclient.contactMethods.update(data={}, parentId='', nestedId='')Response status codeExpensesMethodsMethodReturnsclient.expenses.create(data={}, parentId='')dictclient.expenses.delete(parentId='', nestedId='')Response status codeclient.expenses.update(data={}, parentId='', nestedId='')Response status codeIncomesMethodsMethodReturnsclient.incomes.create(data={}, parentId='')dictclient.incomes.delete(parentId='', nestedId='')Response status codeclient.incomes.update(data={}, parentId='', nestedId='')Response status codeAssetsMethodsMethodReturnsclient.assets.create(data={}, parentId='')dictclient.assets.delete(parentId='', nestedId='')Response status codeclient.assets.update(data={}, parentId='', nestedId='')Response status codeLiabilitiesMethodsMethodReturnsclient.liabilities.create(data={}, parentId='')dictclient.liabilities.delete(parentId='', nestedId='')Response status codeclient.liabilities.update(data={}, parentId='', nestedId='')Response status codeRelated PartiesMethodsMethodReturnsclient.relatedParties.create(data={}, parentId='')dictclient.relatedParties.delete(parentId='', nestedId='')Response status codeclient.relatedParties.update(data={}, parentId='', nestedId='')Response status code