Megaventory API v2017a

<back to all web services

SupplierClientUpdate

The following routes are available for this service:
POST/SupplierClient/SupplierClientUpdateInserts a supplier/client or updates an existing one.Uses your API Key and applies a mvRecordAction value on an mvSupplierClient object. We can insert the mvSupplierClient we specified using "Insert" as our mvRecordAction. We can update a current one using "Update", we can insert it if it doesn't already exist, update it if it does using "InsertOrUpdate" and we can insert new fields or update non-empty fields of the object using "InsertOrUpdateNonEmptyFields". Optionally, you can use mvInsertUpdateDeleteSourceApplication when an external application ( eg WooCommerce ) is the one that triggers the SupplierClientUpdate call. SupplierClientId cannot be updated.

Examples:



A.

Insert a new supplier who has 2 contacts. The SupplierClientUpdate call was triggered by Magento.

Value:

 {
   "mvSupplierClient": {
      "SupplierClientType": "Supplier",
      "SupplierClientName": "A4 Paper Supplier",
      "mvContacts": [
         {
            "ContactName": "Andrew Stevens",
            "ContactDepartment": "A4 Papers/Printing",
            "ContactEmail": "andrew@a4printing.jp",
            "ContantIsPrimary": "true"
         },
         {
            "ContactName": "Maria Weems",
            "ContactDepartment": "A4 Papers/Pictures"
         }
      ],
      "SupplierClientBillingAddress": "41st Trueroad , Inglewood CA",
      "SupplierClientShippingAddress": "93rd Kiwi Street, Las Vegas, Nevada"
   },
   "mvGrantPermissionsToAllUser": "true",
   "mvRecordAction": "Insert",
   "mvInsertUpdateDeleteSourceApplication": "Magento"
} 


Response:

 {
   "mvSupplierClient": {
      "SupplierClientID": 23,
      "SupplierClientType": "Supplier",
      "SupplierClientName": "A4 Paper Supplier",
      "mvContacts": [
         {
            "ContactName": "Andrew Stevens",
            "ContactDepartment": "A4 Papers/Printing",
            "ContactEmail": "andrew@a4printing.jp",
            "ContactIsPrimary": false
         },
         {
            "ContactName": "Maria Weems",
            "ContactDepartment": "A4 Papers/Pictures",
            "ContactIsPrimary": false
         }
      ],
      "SupplierClientBillingAddress": "41st Trueroad , Inglewood CA",
      "SupplierClientShippingAddress1": "",
      "SupplierClientShippingAddress2": "",
      "SupplierClientPhone1": "",
      "SupplierClientPhone2": "",
      "SupplierClientFax": "",
      "SupplierClientIM": "",
      "SupplierClientEmail": "",
      "SupplierClientTaxID": "",
      "SupplierClientComments": "",
      "SupplierClientCustomField1": "",
      "SupplierClientCustomField2": "",
      "SupplierClientCustomField3": "",
      "SupplierClientCustomField4": "",
      "SupplierClientCustomField5": "",
      "SupplierClientOption1": "",
      "SupplierClientOption2": "",
      "SupplierClientOption3": "",
      "SupplierClientOption4": "",
      "SupplierClientOption5": "",
      "SupplierClientCreationDate": "/Date(1507628895856+0300)/"
   },
   "ResponseStatus": {
      "ErrorCode": "0"
   },
   "entityID": 23
}

B.



Updates the above supplier by changing his billing address, adding a second shipping address, a phone and an IM contact.

Value:

 {
   "mvSupplierClient": {
      "SupplierClientId": "23",
      "SupplierClientName": "A4 Paper Supplier",
      "SupplierClientBillingAddress": "47th Trueroad , Inglewood CA",
      "SupplierClientShippingAddress2": "11th Trueside Boulevard, Jacksonville, FL",
      "SupplierClientPhone1": "+113236237323232",
      "SupplierClientIM": "@andrewstevens2017"
   },
   "mvRecordAction": "Update"
} 


Response:

 {
   "mvSupplierClient": {
      "SupplierClientID": 23,
      "SupplierClientType": "Supplier",
      "SupplierClientName": "A4 Paper Supplier",
      "mvContacts": [],
      "SupplierClientBillingAddress": "47th Trueroad , Inglewood CA",
      "SupplierClientShippingAddress1": "",
      "SupplierClientShippingAddress2": "11th Trueside Boulevard, Jacksonville, FL",
      "SupplierClientPhone1": "+113236237323232",
      "SupplierClientPhone2": "",
      "SupplierClientFax": "",
      "SupplierClientIM": "@andrewstevens2017",
      "SupplierClientEmail": "",
      "SupplierClientTaxID": "",
      "SupplierClientCustomField1": "",
      "SupplierClientCustomField2": "",
      "SupplierClientCustomField3": "",
      "SupplierClientCustomField4": "",
      "SupplierClientCustomField5": "",
      "SupplierClientOption1": "",
      "SupplierClientOption2": "",
      "SupplierClientOption3": "",
      "SupplierClientOption4": "",
      "SupplierClientOption5": "",
      "SupplierClientComments": "",
      "SupplierClientCreationDate": "/Date(1507628895857-0000)/"
   },
   "ResponseStatus": {
      "ErrorCode": "0"
   },
   "entityID": 23
}

To override the Content-type in your clients HTTP Accept Header, append the .csv suffix or ?format=csv

HTTP + CSV

The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.

POST /csv/reply/SupplierClientUpdate HTTP/1.1 
Host: api.megaventory.com 
Content-Type: text/csv
Content-Length: length

SupplierClientID,SupplierClientType,SupplierClientName,SupplierClientBillingAddress,SupplierClientShippingAddress1,SupplierClientShippingAddress2,SupplierClientAddresses,SupplierClientPhone1,SupplierClientPhone2,SupplierClientFax,SupplierClientIM,SupplierClientEmail,SupplierClientTaxID,SupplierClientCurrency,SupplierClientPaymentTermsEnum,SupplierClientPaymentMethodEnum,SupplierClientComments,SupplierClientCustomField1,SupplierClientCustomField2,SupplierClientCustomField3,SupplierClientCustomField4,SupplierClientCustomField5,SupplierClientOption1,SupplierClientOption2,SupplierClientOption3,SupplierClientOption4,SupplierClientOption5,SupplierClientCreationDate,mvContacts
0,Both,String,String,String,String,"[{AddressType:General,AddressLine1:String,AddressLine2:String,AddressLine3:String,Name:String,Phone:String,Email:String,TaxIdNumber:String,Organization:String,City:String,State:String,Country:NONE,CountryName:String,Longitude:String,Latitude:String,ZipCode:String}]",String,String,String,String,String,String,String,None,None,String,String,String,String,String,String,False,False,False,False,False,0001-01-01,"[{ContactId:0,ContactName:String,ContactDepartment:String,ContactAddress:String,ContactFullAddress:{AddressType:General,AddressLine1:String,AddressLine2:String,AddressLine3:String,Name:String,Phone:String,Email:String,TaxIdNumber:String,Organization:String,City:String,State:String,Country:NONE,CountryName:String,Longitude:String,Latitude:String,ZipCode:String},ContactEmail:String,ContactPhone1:String,ContactPhone2:String,ContactFax:String,ContactIM:String,ContactCustomField1:String,ContactCustomField2:String,ContactIsPrimary:False,mvSuppliersClients:[{SupplierClientID:0,SupplierClientType:Both,SupplierClientName:String,SupplierClientBillingAddress:String,SupplierClientShippingAddress1:String,SupplierClientShippingAddress2:String,SupplierClientAddresses:[{AddressType:General,AddressLine1:String,AddressLine2:String,AddressLine3:String,Name:String,Phone:String,Email:String,TaxIdNumber:String,Organization:String,City:String,State:String,Country:NONE,CountryName:String,Longitude:String,Latitude:String,ZipCode:String}],SupplierClientPhone1:String,SupplierClientPhone2:String,SupplierClientFax:String,SupplierClientIM:String,SupplierClientEmail:String,SupplierClientCurrency:String,SupplierClientPaymentTermsEnum:None,SupplierClientPaymentMethodEnum:None,SupplierClientComments:String,SupplierClientCustomField1:String,SupplierClientCustomField2:String,SupplierClientCustomField3:String,SupplierClientCustomField4:String,SupplierClientCustomField5:String,SupplierClientOption1:False,SupplierClientOption2:False,SupplierClientOption3:False,SupplierClientOption4:False,SupplierClientOption5:False,SupplierClientCreationDate:0001-01-01,mvContacts:[{ContactId:0,ContactName:String,ContactDepartment:String,ContactAddress:String,ContactFullAddress:{AddressType:General,AddressLine1:String,AddressLine2:String,AddressLine3:String,Name:String,Phone:String,Email:String,TaxIdNumber:String,Organization:String,City:String,State:String,Country:NONE,CountryName:String,Longitude:String,Latitude:String,ZipCode:String},ContactEmail:String,ContactPhone1:String,ContactPhone2:String,ContactFax:String,ContactIM:String,ContactCustomField1:String,ContactCustomField2:String,ContactIsPrimary:False,mvSuppliersClients:[{SupplierClientID:0,SupplierClientType:Both,SupplierClientName:String,SupplierClientBillingAddress:String,SupplierClientShippingAddress1:String,SupplierClientShippingAddress2:String,SupplierClientAddresses:[{AddressType:General,AddressLine1:String,AddressLine2:String,AddressLine3:String,Name:String,Phone:String,Email:String,TaxIdNumber:String,Organization:String,City:String,State:String,Country:NONE,CountryName:String,Longitude:String,Latitude:String,ZipCode:String}],SupplierClientPhone1:String,SupplierClientPhone2:String,SupplierClientFax:String,SupplierClientIM:String,SupplierClientEmail:String,SupplierClientCurrency:String,SupplierClientPaymentTermsEnum:None,SupplierClientPaymentMethodEnum:None,SupplierClientComments:String,SupplierClientCustomField1:String,SupplierClientCustomField2:String,SupplierClientCustomField3:String,SupplierClientCustomField4:String,SupplierClientCustomField5:String,SupplierClientOption1:False,SupplierClientOption2:False,SupplierClientOption3:False,SupplierClientOption4:False,SupplierClientOption5:False,SupplierClientCreationDate:0001-01-01,mvContacts:[{ContactId:0,ContactName:String,ContactDepartment:String,ContactAddress:String,ContactFullAddress:{AddressType:General,AddressLine1:String,AddressLine2:String,AddressLine3:String,Name:String,Phone:String,Email:String,TaxIdNumber:String,Organization:String,City:String,State:String,Country:NONE,CountryName:String,Longitude:String,Latitude:String,ZipCode:String},ContactEmail:String,ContactPhone1:String,ContactPhone2:String,ContactFax:String,ContactIM:String,ContactCustomField1:String,ContactCustomField2:String,ContactIsPrimary:False,mvSuppliersClients:[{}]}],SupplierClientTaxID:String}]}],SupplierClientTaxID:String}]}]"

HTTP/1.1 200 OK
Content-Type: text/csv
Content-Length: length

SupplierClientID,SupplierClientType,SupplierClientName,SupplierClientBillingAddress,SupplierClientShippingAddress1,SupplierClientShippingAddress2,SupplierClientAddresses,SupplierClientPhone1,SupplierClientPhone2,SupplierClientFax,SupplierClientIM,SupplierClientEmail,SupplierClientTaxID,SupplierClientCurrency,SupplierClientPaymentTermsEnum,SupplierClientPaymentMethodEnum,SupplierClientComments,SupplierClientCustomField1,SupplierClientCustomField2,SupplierClientCustomField3,SupplierClientCustomField4,SupplierClientCustomField5,SupplierClientOption1,SupplierClientOption2,SupplierClientOption3,SupplierClientOption4,SupplierClientOption5,SupplierClientCreationDate,mvContacts
0,Both,String,String,String,String,"[{AddressType:General,AddressLine1:String,AddressLine2:String,AddressLine3:String,Name:String,Phone:String,Email:String,TaxIdNumber:String,Organization:String,City:String,State:String,Country:NONE,CountryName:String,Longitude:String,Latitude:String,ZipCode:String}]",String,String,String,String,String,String,String,None,None,String,String,String,String,String,String,False,False,False,False,False,0001-01-01,"[{ContactId:0,ContactName:String,ContactDepartment:String,ContactAddress:String,ContactFullAddress:{AddressType:General,AddressLine1:String,AddressLine2:String,AddressLine3:String,Name:String,Phone:String,Email:String,TaxIdNumber:String,Organization:String,City:String,State:String,Country:NONE,CountryName:String,Longitude:String,Latitude:String,ZipCode:String},ContactEmail:String,ContactPhone1:String,ContactPhone2:String,ContactFax:String,ContactIM:String,ContactCustomField1:String,ContactCustomField2:String,ContactIsPrimary:False,mvSuppliersClients:[{SupplierClientID:0,SupplierClientType:Both,SupplierClientName:String,SupplierClientBillingAddress:String,SupplierClientShippingAddress1:String,SupplierClientShippingAddress2:String,SupplierClientAddresses:[{AddressType:General,AddressLine1:String,AddressLine2:String,AddressLine3:String,Name:String,Phone:String,Email:String,TaxIdNumber:String,Organization:String,City:String,State:String,Country:NONE,CountryName:String,Longitude:String,Latitude:String,ZipCode:String}],SupplierClientPhone1:String,SupplierClientPhone2:String,SupplierClientFax:String,SupplierClientIM:String,SupplierClientEmail:String,SupplierClientCurrency:String,SupplierClientPaymentTermsEnum:None,SupplierClientPaymentMethodEnum:None,SupplierClientComments:String,SupplierClientCustomField1:String,SupplierClientCustomField2:String,SupplierClientCustomField3:String,SupplierClientCustomField4:String,SupplierClientCustomField5:String,SupplierClientOption1:False,SupplierClientOption2:False,SupplierClientOption3:False,SupplierClientOption4:False,SupplierClientOption5:False,SupplierClientCreationDate:0001-01-01,mvContacts:[{ContactId:0,ContactName:String,ContactDepartment:String,ContactAddress:String,ContactFullAddress:{AddressType:General,AddressLine1:String,AddressLine2:String,AddressLine3:String,Name:String,Phone:String,Email:String,TaxIdNumber:String,Organization:String,City:String,State:String,Country:NONE,CountryName:String,Longitude:String,Latitude:String,ZipCode:String},ContactEmail:String,ContactPhone1:String,ContactPhone2:String,ContactFax:String,ContactIM:String,ContactCustomField1:String,ContactCustomField2:String,ContactIsPrimary:False,mvSuppliersClients:[{SupplierClientID:0,SupplierClientType:Both,SupplierClientName:String,SupplierClientBillingAddress:String,SupplierClientShippingAddress1:String,SupplierClientShippingAddress2:String,SupplierClientAddresses:[{AddressType:General,AddressLine1:String,AddressLine2:String,AddressLine3:String,Name:String,Phone:String,Email:String,TaxIdNumber:String,Organization:String,City:String,State:String,Country:NONE,CountryName:String,Longitude:String,Latitude:String,ZipCode:String}],SupplierClientPhone1:String,SupplierClientPhone2:String,SupplierClientFax:String,SupplierClientIM:String,SupplierClientEmail:String,SupplierClientCurrency:String,SupplierClientPaymentTermsEnum:None,SupplierClientPaymentMethodEnum:None,SupplierClientComments:String,SupplierClientCustomField1:String,SupplierClientCustomField2:String,SupplierClientCustomField3:String,SupplierClientCustomField4:String,SupplierClientCustomField5:String,SupplierClientOption1:False,SupplierClientOption2:False,SupplierClientOption3:False,SupplierClientOption4:False,SupplierClientOption5:False,SupplierClientCreationDate:0001-01-01,mvContacts:[{ContactId:0,ContactName:String,ContactDepartment:String,ContactAddress:String,ContactFullAddress:{AddressType:General,AddressLine1:String,AddressLine2:String,AddressLine3:String,Name:String,Phone:String,Email:String,TaxIdNumber:String,Organization:String,City:String,State:String,Country:NONE,CountryName:String,Longitude:String,Latitude:String,ZipCode:String},ContactEmail:String,ContactPhone1:String,ContactPhone2:String,ContactFax:String,ContactIM:String,ContactCustomField1:String,ContactCustomField2:String,ContactIsPrimary:False,mvSuppliersClients:[{}]}],SupplierClientTaxID:String}]}],SupplierClientTaxID:String}]}]"