Toggle Side Panel

  • Home
  • Articles
    • All Articles
    • Blogs
    • Videos
    • Infographics
  • Consultants
    • Salesforce Product Expertise
      • Top Salesforce ConsultantsTop Salesforce Consultants
      • Marketing Cloud ConsultantsMarketing Cloud Consultants
      • Service Cloud ConsultantsService Cloud Consultants
      • Experience Cloud ConsultantsExperience Cloud Consultants
      • Analytics Cloud ConsultantsAnalytics Cloud Consultants
    • Salesforce Industry Expertise
      • Non-Profit Cloud ConsultantsNon-Profit Cloud Consultants
      • Financial Service Cloud ConsultantsFinancial Service Cloud Consultants
      • Health Cloud ConsultantsHealth Cloud Consultants
      • Commerce Cloud ConsultantsCommerce Cloud Consultants
      • Manufacturing Cloud ConsultantsManufacturing Cloud Consultants
    • Salesforce Experts by Location
      • USATop Salesforce Consultants in USA
      • IndiaTop Salesforce Consultants in India
      • AustraliaTop Salesforce Consultants in Australia
      • United KingdomTop Salesforce Consultants in UK
      • CanadaTop Salesforce Consultants in Canada
  • Webinars
  • Marketplace
  • Advertise With Us
  • Contact Us
  • Discussions
More options
    Sign in Sign up
    • Home
    • Articles
      • All Articles
      • Blogs
      • Videos
      • Infographics
    • Consultants
      • Salesforce Product Expertise
        • Top Salesforce ConsultantsTop Salesforce Consultants
        • Marketing Cloud ConsultantsMarketing Cloud Consultants
        • Service Cloud ConsultantsService Cloud Consultants
        • Experience Cloud ConsultantsExperience Cloud Consultants
        • Analytics Cloud ConsultantsAnalytics Cloud Consultants
      • Salesforce Industry Expertise
        • Non-Profit Cloud ConsultantsNon-Profit Cloud Consultants
        • Financial Service Cloud ConsultantsFinancial Service Cloud Consultants
        • Health Cloud ConsultantsHealth Cloud Consultants
        • Commerce Cloud ConsultantsCommerce Cloud Consultants
        • Manufacturing Cloud ConsultantsManufacturing Cloud Consultants
      • Salesforce Experts by Location
        • USATop Salesforce Consultants in USA
        • IndiaTop Salesforce Consultants in India
        • AustraliaTop Salesforce Consultants in Australia
        • United KingdomTop Salesforce Consultants in UK
        • CanadaTop Salesforce Consultants in Canada
    • Webinars
    • Marketplace
    • Advertise With Us
    • Contact Us
    • Discussions
    Close search

    Activity › Forums › Salesforce® Discussions › How to convert lead to account using REST API in salesforce?

    Tagged: Account, Lead Conversion, Rest API, Salesforce Development

    • Salesforce® Discussions

      How to convert lead to account using REST API in salesforce?

      Posted by Vikas Kumar on January 3, 2017 at 2:02 PM

      Hi All,

      How can we convert lead to account using Rest Api

      Thanks

      Shekhar Gadewar replied 9 years ago 3 Members · 2 Replies
      • Account
      • Lead Conversion
      • Rest API
      • Salesforce Development
    • 2 Replies
    • Ajit

      Member
      January 4, 2017 at 5:43 AM

      Hi

      try this code below and let me know it worked or not :

      @RestResource(urlMapping='/Lead/*')
      global with sharing class RestLeadConvert {

      @HttpGet
      global static String doGet() {
      String ret = 'fail';
      RestRequest req = RestContext.request;
      RestResponse res = RestContext.response;
      String leadId = req.requestURI.substring(req.requestURI.lastIndexOf('/')+1);
      Database.LeadConvert lc = new Database.LeadConvert();
      lc.setLeadId(leadId);

      LeadStatus convertStatus = [SELECT Id, MasterLabel FROM LeadStatus WHERE IsConverted=true LIMIT 1];
      lc.setConvertedStatus(convertStatus.MasterLabel);
      Database.LeadConvertResult lcr ;
      try{
      lcr = Database.convertLead(lc);
      system.debug('*****lcr.isSuccess()'+lcr.isSuccess());
      ret = 'ok';
      }
      catch(exception ex){
      system.debug('***NOT CONVERTED**');
      }
      return ret;
      }
      }

    • Shekhar Gadewar

      Member
      January 5, 2017 at 5:11 AM

      Hi Ajit,

       

      Thanks for sharing snippet.

      Can u tell me how to test that?

      How we can check that code in execution?

       

      Thanks

    Log In to reply.

    • Public
    • All Members
    • My Connections
    • Only Me
    • Public
    • All Members
    • My Connections
    • Only Me
    • Public
    • All Members
    • My Connections
    • Only Me

    application solution

    Popular Salesforce Blogs

    sales cloud

    6 Ways To Utilize Salesforce Sales Cloud To Its Fullest

    Blog in Sales, Salesforce Cloud Platform, Salesforce Implementation

    Salesforce holds the top spot in the industry when it comes to streamlining business processes. Having been around for over 20 years now, Salesforce has…

    Application Programming Interface, Applications, Automated Data, Automation, Best Leads
    Melonleaf Jun 28, 2022
    2,062  Views

    7 Different Types of Object Relations in Salesforce

    Blog in Salesforce

    Understanding Data Relationships between objects in Salesforce can be challenging. There can be a situation in a company where you have to create a bespoke…

    Salesforce Online Training, salesforcedeveloper
    Ray brad Aug 1, 2025
    180  Views

    Boost Your Business Growth with Salesforce Managed Services: Key Benefits and Expert Tips

    Blog in Salesforce

    Using the appropriate tools and technologies is essential to staying ahead of the competition in the fast-paced corporate world of today. Salesforce, a leading Customer…

    managedservicesforsalesforce, Salesforce Consulting Services, Salesforce Solutions
    TechForce Aug 1, 2025
    164  Views

    Popular Salesforce Videos

    Increase ROI by Investing in People | Make Earth Your Business

    Increase ROI by Investing in People | Make Earth Your Business

    Video in

    The video discusses the benefits of businesses that invest in and believe in their employees, customers, and communities. Investing in employee training and upskilling programs…

    salesforce, Customers, Employees, Productivity, Businesses
    Jogender Apr 18, 2023
    984  Views
    Lightning Component In Salesforce

    Lightning Component In Salesforce

    Video in Lightning, Salesforce Development

    In this video, we are going to look into: Lightning Component Lightning Component features Types of Lightning Component Lightning Component bundle Watch this video and…

    Salesforce Developer, Salesforce Lightning, salesforce, Salesforce Admin, Lightning Component Bundle
    kanika May 12, 2021
    1,661  Views
    How to Compare Change Sets from Another Org ? #Salesforce Change Sets Helper | Salesforce Tutorials

    How to Compare Change Sets from Another Org ? #Salesforce Change Sets Helper | Salesforce Tutorials

    Video in Salesforce Training, Salesforce Admin

    Change set with sort, view all, and additional information, such as last modified date. Allows comparison with other orgs. A chrome extension to improve the…

    Salesforce Training, Salesforce Tutorial, salesforce, Salesforce Org, Salesforce Admin
    Kapil May 22, 2020
    5,950  Views
    Footer Forcetalks logo

    support@forcetalks.com

    • twitterx

    Quick Links

    Advertise with Us

    Salesforce® Articles

    Dreamforce 2023

    Top Salesforce® Bloggers 2023

    Top Salesforce Consultants

    Get Listed

    Company

    Contact Us

    About Us

    Privacy Policy

    Terms & Conditions

    InsightHub

    Salesforce Blogs

    Salesforce Videos

    Salesforce Groups

    Salesforce Jobs

    © 2026 - Forcetalks ● All Rights Reserved

    Salesforce® is a trademark of Salesforce® Inc. No claim is made to the exclusive right to use “Salesforce”. Any services offered within the Forcetalks website/app are not sponsored or endorsed by Salesforce®.

    Try AuditMyCRM - It is a Salesforce CRM Audit tool which comprehensively scans your Salesforce org and gives you the list of errors or warnings you need to take care of.
    We use cookies to enhance your browsing experience. Please see our privacy policy if you'd like more information on our use of cookies.