Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Power Apps Pro Dev & ISV
Unanswered

Azure Web API and CDSWebApiService Class

(0) ShareShare
ReportReport
Posted on by 11,409 Super User 2025 Season 1

Hello,

 

I am creating a an Azure API that connects to the CDS Web API and I am trying to use the class CDSWebApiService mentioned in the samples below:

https://docs.microsoft.com/en-us/powerapps/developer/common-data-service/webapi/samples/cdswebapiservice

 

I have rebuilt all code in my API Project but the case that when i use the post to create a contact based on the sample , although the contact is physically created but there is no response getting back

 

 

 

 

 

 string connectionString = ConfigurationManager.ConnectionStrings["Connect"].ConnectionString;
 ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11;

 ServiceConfig config = new ServiceConfig(connectionString);
 using (CDSWebApiService svc = new CDSWebApiService(config))
 {
 // Console.WriteLine("--Starting Basic Operations--");

 
 ////Create a contact
 var contact1 = new JObject
 {
 { "firstname", "Rafel" },
 { "lastname", "Shillo" }
 };
 Uri contact1Uri = svc.PostCreate("contacts", contact1);
 return contact1Uri.AbsolutePath;
 }

 

 

 

 

 

Any Help will be appreciated !

 

  • tacklers Profile Picture
    150 on at
    Re: Azure Web API and CDSWebApiService Class

    Hi Scott, I listen to you a lot on podcasts so I know you. Your solution to this problem didn't work. We have it too. Anything else you can please suggest? Cheers, Richard

  • Mira Ghaly Profile Picture
    11,409 Super User 2025 Season 1 on at
    Re: Azure Web API and CDSWebApiService Class

    @ScottDurow 

    I tried to use PostCreateAsync but it returned an Exception Task was cancelled.

     

    This is how i call it from my API , it just never returns the URI 

    public string Post([FromBody]string value)
     {
     string connectionString = ConfigurationManager.ConnectionStrings["Connect"].ConnectionString;
     ServiceConfig config = new ServiceConfig(connectionString);
    
     using (CDSWebApiService svc = new CDSWebApiService(config))
     {
     // Console.WriteLine("--Starting Basic Operations--");
    
     ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11;
    
     //Create a contact
     var contact1 = new JObject
     {
     { "firstname", "Mira" },
     { "lastname", "WEB API" }
     };
     return svc.PostCreate("contacts", contact1).ToString();
    
     
     }
     
     
     
     
    
     }
  • ScottDurow Profile Picture
    1,039 on at
    Re: Azure Web API and CDSWebApiService Class

    I suspect there may be an issue with the async implementation that you are using - can you try and implement the call using the PostCreateAsync method?

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Power Apps - Power Apps Pro Dev & ISV

#1
WarrenBelz Profile Picture

WarrenBelz 85 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 57 Super User 2025 Season 1

#3
mmbr1606 Profile Picture

mmbr1606 55 Super User 2025 Season 1

Overall leaderboard