DNN Forums

Ask questions about your website to get help learning DNN and help resolve issues.

DNN v9.10.02 Web API

Sort:
You are not authorized to post a reply.
Page 1 of 212 > >>





New Around Here





    Team,

     I have a small query, Suppose I have created 1 web api say getcustomer()

    DesktopModules/Leads/API/LeadsDisposition/getcustomer

    Now I have 2 domain 1 is main domain say www.maindomain.com and other is subdomain say www.subdomain.maindomain.com

    Now can we set api address like

    www.subdomain.maindomain.com/DesktopModules/Leads/API/LeadsDisposition/getcustomer

    instead of 

    www.maindomain.com/DesktopModules/Leads/API/LeadsDisposition/getcustomer

    Inshort can we set base url as subdomain for web api?

    Please suggest. Awaiting for your response.






    Advanced Member





      The API that you've declared should be accessible from all portal aliases. Are you getting an error using the other domain?
      DNN partner specializing in custom, enterprise DNN development https://engagesoftware.com/showcase





      Veteran Member





        Posted By Brian Dukes on 11/15/2022 6:02 AM
        The API that you've declared should be accessible from all portal aliases. Are you getting an error using the other domain?

        As Brian mentioned, there's nothing you need to do for the other websites on your DNN instance to also use the same API endpoints. 

        The very nature of how the calls are made will always ensure that API calls from Site1 to the API are for and returned to the Site1 calling code. 

        So a call made from the maindomain.com to API endpoint will automatically know and use the same domain.  

        Then, if another site calls, such as subdomain.mainsite.com, it will have the same path, but on a different domain...  The code is still the same.  

        So a call made from the subdomain.maindomain.com to API endpoint will automatically know and use the same subdomain.  

        There is nothing more you need to do.  Most of the time, the main issues are not with the domain name, but the path that Web API has and what you expect it to be.  :) 

         






        New Around Here





          Thanks for your reply, Unfortunately I am getting below error while calling API using subdomain,

          Error: getaddrinfo ENOTFOUND subdomain.maindomain.com

          eventhough my actual subdomain is different but I am getting above error. Please suggest.






          Advanced Member





            This is an issue in your calling code, not with the API. Maybe the subdomain doesn't have a valid certificate setup?
            DNN partner specializing in custom, enterprise DNN development https://engagesoftware.com/showcase





            Veteran Member





              I would also suggest looking in your code for anything that might be specifically targeting and/or expecting a hard-coded domain name. If you have such code, that would be the first place I'd look to figure out why only one domain is having the issue.  

              Beyond that, I still sometimes find myself adding and using the following tool to diagnose issues with Web API in DNN.  Though, there might be a better one these days.  Not sure...  

              https://github.com/jbrinkman/dnnGlimpse






              Veteran Member





                Oh, and regarding Brian's suggestion, you can use any client-side inspection tool to detect that, including the web developer tools in any contemporary web browser, and ones like Postman.  






                New Around Here





                  Team,

                  Issue is yet to resolve, I am sharing below 2 postman screenshot 1 is through root domain and other through subdomain. Through Subdomain I am still getting error. but same subdomain we are using for long time which is working fine. We are only facing issue when this subdomain used for Web API, I don't know is there any routing configuration issue or not, if it is not then what else. I don't know what are the things I am missing. Please guide.

                  1. Root Domain

                  2. Sub Domain

                   

                  Regards,

                  Shyamal






                  Veteran Member





                    It sounds like you might need to troubleshoot your route, because it can be tricky, depending on how you've registered your routes. I just created a blog post and video to help you.  

                    https://dnncommunity.org/...eb-API-Routes-in-DNN






                    New Around Here





                      I have installed Glimpse and also eanabled it successfully but unfortunately after reload the page it does not show up that big G. So due to it is not visible unable to inspect the API routes .  Please suggest if any other way I can check that.

                      You are not authorized to post a reply.
                      Page 1 of 212 > >>

                      These Forums are dedicated to the discussion of DNN Platform.

                      For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

                      1. If you have (suspected) security issues, please DO NOT post them in the forums but instead follow the official DNN security policy
                      2. No Advertising. This includes the promotion of commercial and non-commercial products or services which are not directly related to DNN.
                      3. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
                      4. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
                      5. No Flaming or Trolling.
                      6. No Profanity, Racism, or Prejudice.
                      7. Site Moderators have the final word on approving / removing a thread or post or comment.
                      8. English language posting only, please.

                      Would you like to help us?

                      Awesome! Simply post in the forums using the link below and we'll get you started.

                      Get Involved