Method Community

 

Using MethodAPIInsertV2

Last post 08-16-2017 7:33 AM by Method_Peter. 4 replies.
Page 1 of 1 (5 items)
Sort Posts: Previous Next
  • 08-09-2017 1:56 PM

    • DLi
    • Not Ranked
    • Joined on 08-09-2017
    • Posts 4

    Using MethodAPIInsertV2

    Hello! I'm trying to use methodAPIInsertV2 to insert a record into the Customer table... I'm getting an error message: "Please enter at least one field array."  I've added the fields under InsertFieldsArray, am I missing something?  Thank you!


    This is what I'm using:

    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tem="http://tempuri.org/">
    <soapenv:Header/>
    <soapenv:Body>
    <tem:MethodAPIInsertV2>
    <!--Optional:-->
    <tem:strCompanyAccount>AccountName</tem:strCompanyAccount>
    <!--Optional:-->
    <tem:strLogin>login@login.com</tem:strLogin>
    <!--Optional:-->
    <tem:strPassword>password</tem:strPassword>
    <!--Optional:-->
    <tem:strTable>Customer</tem:strTable>
    <!--Optional:-->
    <tem:arrInsertFieldsArray>
    <!--Zero or more repetitions:-->
    <string>TenantID</string>
    <string>FirstName</string>
    <string>LastName</string>
    <string>Email</string>
    <string>BillAddressAddr1</string>
    <string>BillAddressAddr2</string>
    <string>BillAddressCity</string>
    <string>BillAddressState</string>
    <string>BillAddressPostalCode</string>
    <string>Phone</string>
    <string>AltPhone</string>
    <string>AltContact</string>
    <string>Branch</string>
    <string>SalesRep</string>
    <string>VelocifyLeadID</string>
    </tem:arrInsertFieldsArray>
    <!--Optional:-->
    <tem:arrInsertValueArray>
    <!--Zero or more repetitions:-->
    <string>1</string>
    <string>TestFName</string>
    <string>TestLName</string>
    <string>testemail@test.com</string>
    <string>123 Test Street</string>
    <string>Apt A</string>
    <string>Los Angeles</string>
    <string>CA</string>
    <string>90005</string>
    <string>213-111-2222</string>
    <string>310-222-3333</string>
    <string>310-555-1111</string>
    <string>Test Rep</string>
    <string>123456</string>
    </tem:arrInsertValueArray>
    </tem:MethodAPIInsertV2>
    </soapenv:Body>
    </soapenv:Envelope>


  • 08-09-2017 2:18 PM In reply to

    Re: Using MethodAPIInsertV2

    The number of InsertFields (15) does not match the number of InsertValues (14).  It looks like Branch is missing from the InsertValues.

    Peter Dyer
    Product Manager - Method
  • 08-09-2017 4:12 PM In reply to

    • DLi
    • Not Ranked
    • Joined on 08-09-2017
    • Posts 4

    Re: Using MethodAPIInsertV2

    Thank you, I added one more field string, but still getting the same response:

    <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <soap:Body>
    <MethodAPIInsertV2Response xmlns="http://tempuri.org/">
    <MethodAPIInsertV2Result>&lt;?xml version="1.0" encoding="windows-1252" ?>&lt;MethodAPI response = "Please enter at least one field array." >&lt;/MethodAPI></MethodAPIInsertV2Result>
    </MethodAPIInsertV2Response>
    </soap:Body>
    </soap:Envelope>



    This is the request I used:

    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tem="http://tempuri.org/">
    <soapenv:Header/>
    <soapenv:Body>
    <tem:MethodAPIInsertV2>
    <!--Optional:-->
    <tem:strCompanyAccount>acctname</tem:strCompanyAccount>
    <!--Optional:-->
    <tem:strLogin>login</tem:strLogin>
    <!--Optional:-->
    <tem:strPassword>bpassword</tem:strPassword>
    <!--Optional:-->
    <tem:strTable>Customer</tem:strTable>
    <!--Optional:-->
    <tem:arrInsertFieldsArray>
    <!--Zero or more repetitions:-->
    <string>TenantID</string>
    <string>FirstName</string>
    <string>LastName</string>
    <string>Email</string>
    <string>BillAddressAddr1</string>
    <string>BillAddressAddr2</string>
    <string>BillAddressCity</string>
    <string>BillAddressState</string>
    <string>BillAddressPostalCode</string>
    <string>Phone</string>
    <string>AltPhone</string>
    <string>AltContact</string>
    <string>Branch</string>
    <string>SalesRep</string>
    <string>VelocifyLeadID</string>
    </tem:arrInsertFieldsArray>
    <!--Optional:-->
    <tem:arrInsertValueArray>
    <!--Zero or more repetitions:-->
    <string>1</string>
    <string>TestFName</string>
    <string>TestLName</string>
    <string>testemail@test.com</string>
    <string>123 Test Street</string>
    <string>Apt A</string>
    <string>Los Angeles</string>
    <string>CA</string>
    <string>90005</string>
    <string>213-111-2222</string>
    <string>310-222-3333</string>
    <string>310-555-1111</string>
    <string>Austin</string>
    <string>Test Rep</string>
    <string>123456</string>
    </tem:arrInsertValueArray>
    </tem:MethodAPIInsertV2>
    </soapenv:Body>
    </soapenv:Envelope>


  • 08-16-2017 7:30 AM In reply to

    Re: Using MethodAPIInsertV2

    The error is caused by the formatting on the strings in the Arrays.  They are: <string>something</string>.  They need to follow the formatting of the parent: <tem:string>something</tem:string>

    There is a subsequent error that Name is a required field on the Customer table.  Also, the SalesRep is a reference to a separate table, be sure to use a real value.

    The follow request will work:

    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tem="http://tempuri.org/">
    <soapenv:Header/>
    <soapenv:Body>
    <tem:MethodAPIInsertV2>
    <tem:strCompanyAccount>{{account}}</tem:strCompanyAccount>
    <tem:strLogin>{{login}}</tem:strLogin>
    <tem:strPassword>{{password}}</tem:strPassword>
    <tem:strTable>Customer</tem:strTable>
    <tem:arrInsertFieldsArray>
    <tem:string>Name</tem:string>
    <tem:string>TenantID</tem:string>
    <tem:string>FirstName</tem:string>
    <tem:string>LastName</tem:string>
    <tem:string>Email</tem:string>
    <tem:string>BillAddressAddr1</tem:string>
    <tem:string>BillAddressAddr2</tem:string>
    <tem:string>BillAddressCity</tem:string>
    <tem:string>BillAddressState</tem:string>
    <tem:string>BillAddressPostalCode</tem:string>
    <tem:string>Phone</tem:string>
    <tem:string>AltPhone</tem:string>
    <tem:string>AltContact</tem:string>
    <tem:string>Branch</tem:string>
    <tem:string>SalesRep</tem:string>
    <tem:string>VelocifyLeadID</tem:string>
    </tem:arrInsertFieldsArray>
    <tem:arrInsertValueArray>
    <tem:string>TestFName TestLName 2</tem:string>
    <tem:string>1</tem:string>
    <tem:string>TestFName</tem:string>
    <tem:string>TestLName</tem:string>
    <tem:string>testemail@test.com</tem:string>
    <tem:string>123 Test Street</tem:string>
    <tem:string>Apt A</tem:string>
    <tem:string>Los Angeles</tem:string>
    <tem:string>CA</tem:string>
    <tem:string>90005</tem:string>
    <tem:string>213-111-2222</tem:string>
    <tem:string>310-222-3333</tem:string>
    <tem:string>310-555-1111</tem:string>
    <tem:string>Austin</tem:string>
    <tem:string>RJL</tem:string>
    <tem:string>123456</tem:string>
    </tem:arrInsertValueArray>
    </tem:MethodAPIInsertV2>
    </soapenv:Body>
    </soapenv:Envelope>

    Response:


    <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <soap:Body>
    <MethodAPIInsertV2Response xmlns="http://tempuri.org/">
    <MethodAPIInsertV2Result>&lt;?xml version="1.0" encoding="windows-1252" ?>&lt;MethodAPI response = "SuccessSendToDesktop" RecordID="57306" >&lt;/MethodAPI></MethodAPIInsertV2Result>
    </MethodAPIInsertV2Response>
    </soap:Body>
    </soap:Envelope>


    Peter Dyer
    Product Manager - Method
  • 08-16-2017 7:33 AM In reply to

    Re: Using MethodAPIInsertV2

    Note that this thread uses TenantID.  This is only relevant for customers who have a multi-tenant Method:CRM account.  If you are unsure if you have a multi-tenant account you likely don't, the majority of customers do not.  

    If you exclude TentantID from the example above it should work fine for most users.

    Peter Dyer
    Product Manager - Method
Page 1 of 1 (5 items)