How to check whether Apex class with specific name exists or not using C#.Net?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty margin-bottom:0;







up vote
1
down vote

favorite












I have one .Net web service which is used by my Salesforce application.
I have used different Salesforce APIs to interact with Salesforce.
Now, I have created one REST Service in my Salesforce application and before using it in .Net web service, I want to check whether this REST service exists or not.
How can I do that? Do we have any metadata method to check existence of Apex Class/Rest Service?










share|improve this question





















  • you can query ApexClassMember
    – Oleksandr Berehovskiy
    3 hours ago







  • 2




    Why not just call the API and see if it returns a 404?
    – David Reed
    3 hours ago
















up vote
1
down vote

favorite












I have one .Net web service which is used by my Salesforce application.
I have used different Salesforce APIs to interact with Salesforce.
Now, I have created one REST Service in my Salesforce application and before using it in .Net web service, I want to check whether this REST service exists or not.
How can I do that? Do we have any metadata method to check existence of Apex Class/Rest Service?










share|improve this question





















  • you can query ApexClassMember
    – Oleksandr Berehovskiy
    3 hours ago







  • 2




    Why not just call the API and see if it returns a 404?
    – David Reed
    3 hours ago












up vote
1
down vote

favorite









up vote
1
down vote

favorite











I have one .Net web service which is used by my Salesforce application.
I have used different Salesforce APIs to interact with Salesforce.
Now, I have created one REST Service in my Salesforce application and before using it in .Net web service, I want to check whether this REST service exists or not.
How can I do that? Do we have any metadata method to check existence of Apex Class/Rest Service?










share|improve this question













I have one .Net web service which is used by my Salesforce application.
I have used different Salesforce APIs to interact with Salesforce.
Now, I have created one REST Service in my Salesforce application and before using it in .Net web service, I want to check whether this REST service exists or not.
How can I do that? Do we have any metadata method to check existence of Apex Class/Rest Service?







metadata-api .net






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked 3 hours ago









rakesh

185




185











  • you can query ApexClassMember
    – Oleksandr Berehovskiy
    3 hours ago







  • 2




    Why not just call the API and see if it returns a 404?
    – David Reed
    3 hours ago
















  • you can query ApexClassMember
    – Oleksandr Berehovskiy
    3 hours ago







  • 2




    Why not just call the API and see if it returns a 404?
    – David Reed
    3 hours ago















you can query ApexClassMember
– Oleksandr Berehovskiy
3 hours ago





you can query ApexClassMember
– Oleksandr Berehovskiy
3 hours ago





2




2




Why not just call the API and see if it returns a 404?
– David Reed
3 hours ago




Why not just call the API and see if it returns a 404?
– David Reed
3 hours ago










1 Answer
1






active

oldest

votes

















up vote
4
down vote













You can querry the ApexClass using the RestEndpoint and provide your class name in where clause. If it returns record you can say that class exists. You can also query the class code in the body parameter.



Endpoint:



/services/data/v43.0/query?q=SELECT+ID,Name,BODY+FROM+ApexClass+WHERE+NAME+=+'MyClass' 





share|improve this answer




















    Your Answer







    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "459"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    convertImagesToLinks: false,
    noModals: false,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













     

    draft saved


    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsalesforce.stackexchange.com%2fquestions%2f236853%2fhow-to-check-whether-apex-class-with-specific-name-exists-or-not-using-c-net%23new-answer', 'question_page');

    );

    Post as a guest






























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    4
    down vote













    You can querry the ApexClass using the RestEndpoint and provide your class name in where clause. If it returns record you can say that class exists. You can also query the class code in the body parameter.



    Endpoint:



    /services/data/v43.0/query?q=SELECT+ID,Name,BODY+FROM+ApexClass+WHERE+NAME+=+'MyClass' 





    share|improve this answer
























      up vote
      4
      down vote













      You can querry the ApexClass using the RestEndpoint and provide your class name in where clause. If it returns record you can say that class exists. You can also query the class code in the body parameter.



      Endpoint:



      /services/data/v43.0/query?q=SELECT+ID,Name,BODY+FROM+ApexClass+WHERE+NAME+=+'MyClass' 





      share|improve this answer






















        up vote
        4
        down vote










        up vote
        4
        down vote









        You can querry the ApexClass using the RestEndpoint and provide your class name in where clause. If it returns record you can say that class exists. You can also query the class code in the body parameter.



        Endpoint:



        /services/data/v43.0/query?q=SELECT+ID,Name,BODY+FROM+ApexClass+WHERE+NAME+=+'MyClass' 





        share|improve this answer












        You can querry the ApexClass using the RestEndpoint and provide your class name in where clause. If it returns record you can say that class exists. You can also query the class code in the body parameter.



        Endpoint:



        /services/data/v43.0/query?q=SELECT+ID,Name,BODY+FROM+ApexClass+WHERE+NAME+=+'MyClass' 






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered 2 hours ago









        Pranay Jaiswal

        9,45431949




        9,45431949



























             

            draft saved


            draft discarded















































             


            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsalesforce.stackexchange.com%2fquestions%2f236853%2fhow-to-check-whether-apex-class-with-specific-name-exists-or-not-using-c-net%23new-answer', 'question_page');

            );

            Post as a guest













































































            Comments

            Popular posts from this blog

            What does second last employer means? [closed]

            List of Gilmore Girls characters

            Confectionery