How to create LEAD through API

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • emillod
    Active Community Member
    • Apr 2017
    • 1405

    How to create LEAD through API

    Hi,
    i have big problem with lead entity.
    I used Postman to GET all leads, after that i copied one of leads, change request to POST, paste info which i copied before, deleted id field and etc, click "POST" and nothing.. i don't have any success response.. Can you tell me which fields i should fill to successfully create lead through API ?
  • tanya
    Senior Member
    • Jun 2014
    • 4308

    #2
    any of name, accountName, emailAddress, phoneNumber
    what is response code?

    Comment

    • emillod
      Active Community Member
      • Apr 2017
      • 1405

      #3
      I used method POST, with those felds:
      {
      "name": "asd",
      "title": "",
      "status": "New",
      "source": "",
      "industry": "",
      "opportunityAmount": null,
      "website": "",
      "addressStreet": "",
      "addressCity": "",
      "addressState": "",
      "addressCountry": "",
      "addressPostalCode": "",
      "emailAddress": "dafg@adfgadg.asd",
      "phoneNumber": "+48 123 456 789",
      "doNotCall": false,
      "description": "",
      "accountName": "",
      "opportunityAmountCurrency": null,
      "emailAddressIsOptedOut": false,
      "opportunityAmountConverted": null,
      "createdById": "35264363457",
      "createdByName": "asfafafasfaaga",
      "modifiedById": "35264363457",
      "modifiedByName": "asfafafasfaaga",
      "assignedUserId": "35264363457",
      "assignedUserName": "asfafafasfaaga"
      }

      Comment

      • yuri
        Member
        • Mar 2014
        • 8440

        #4
        Just replicate the request sent by the browser when you create a lead. Make sure you pass application/json content type.
        If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

        Comment

        • emillod
          Active Community Member
          • Apr 2017
          • 1405

          #5
          Can you tell me how i can find this request sented by browser?

          Comment

          • tanya
            Senior Member
            • Jun 2014
            • 4308

            #6
            F12 button, Network tab

            Comment

            • emillod
              Active Community Member
              • Apr 2017
              • 1405

              #7
              Can you sent me here request which create lead with: first name, last name, phone number and e-mail? Maybe i'm stupid but i can't find that There is too much information in network tab..

              Comment

              • tanya
                Senior Member
                • Jun 2014
                • 4308

                #8

                [ 'firstName' => 'Test', 'lastName' => 'Hello', 'phoneNumber'=>'123456789', 'emailAddress'=>'test@hello.espo' ]

                Comment

                • emillod
                  Active Community Member
                  • Apr 2017
                  • 1405

                  #9
                  How it's different from my post request?

                  I used method POST, with those felds:
                  {
                  "name": "asd",
                  "title": "",
                  "status": "New",
                  "source": "",
                  "industry": "",
                  "opportunityAmount": null,
                  "website": "",
                  "addressStreet": "",
                  "addressCity": "",
                  "addressState": "",
                  "addressCountry": "",
                  "addressPostalCode": "",
                  "emailAddress": "dafg@adfgadg.asd",
                  "phoneNumber": "+48 123 456 789",
                  "doNotCall": false,
                  "description": "",
                  "accountName": "",
                  "opportunityAmountCurrency": null,
                  "emailAddressIsOptedOut": false,
                  "opportunityAmountConverted": null,
                  "createdById": "35264363457",
                  "createdByName": "asfafafasfaaga",
                  "modifiedById": "35264363457",
                  "modifiedByName": "asfafafasfaaga",
                  "assignedUserId": "35264363457",
                  "assignedUserName": "asfafafasfaaga"
                  }

                  Comment

                  • tanya
                    Senior Member
                    • Jun 2014
                    • 4308

                    #10
                    only name and first/last names
                    any record is created? if not, check request header, content-type

                    Comment

                    Working...