web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Pages / Dataverse Web API Call...
Power Pages
Unanswered

Dataverse Web API Calls in power apps portals

(0) ShareShare
ReportReport
Posted on by 17

I am trying to get records from contact table using WEB API in PowerApps Portal. I am able to Call API/get records with Trial Portal but when I tried to call same API with our client Portal then I get 404 error.

Here is request I am using.

 

 

var fetchXmlQuery = `
<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false">
 <entity name="contact">
 <attribute name="lastname" />
 <attribute name="contactid" />
 </entity>
</fetch>`;

var req = new XMLHttpRequest();
req.open("GET", "https://testportaltrial.powerappsportals.com/_api/data/v9.0/contacts?fetchXml=" +encodeURIComponent(fetchXmlQuery), true);
req.setRequestHeader("Accept", "application/json");
req.setRequestHeader("Content-Type", "application/json; charset=utf-8");
req.send();

 

 

I have configured Site settings:

  1. Name:    Webapi/contact/enabled       Value: True
  2. Name:    Webapi/contact/fields            Value: *

and also added table permissions for contact table with global access type.

 

Here is the response of request:

 

error:

code: "9004010C"

inner error:

code: "9004010C"

message: "Resource not found for the segment {0}."

type: "Resource Does Not Exists"

message: "Resource not found for the segment {0}.

 

 

I am also able to retrieve records using fetch liquid tags but not using Web API in our client portal.
Client Portal Version : 9.3.11.19

AbdulShahied_0-1644242841860.png

 

Categories:
I have the same question (0)
  • ragavanrajan Profile Picture
    7,044 Most Valuable Professional on at

    Hi @AbdulShahied 

     

    If you have enabled all the relevant site settings correct and you are still facing error on the client portal. 

    From the given screenshot, I can see in your fetchxml you have used "contact" as your entity and in the JavaScript, web API call you have referenced as "contacts". Possibly this might be the cause. 

    Can you change it to a proper table name and give it a try?

    Hope it helps.

    ------------

    If you like this post, give it a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users to find it.

  • Abdul-Shahied Shahid Profile Picture
    17 on at

    Hi @ragavanrajan 

    Thank you for your reply, I tried it but it didn't work also in trial portal as it was not working for client portal.

  • ragavanrajan Profile Picture
    7,044 Most Valuable Professional on at

    Hi @AbdulShahied 

     

    Can you enable the "Diagnostic Logging" and post the error which you are getting 

    https://docs.microsoft.com/en-us/powerapps/maker/portals/admin/view-portal-error-log#:~:text=diagnostic%20logging%20again.-,Enable%20diagnostic%20logging,Portal%20Actions%20%3E%20Enable%20diagnostic%20logging.&text=Select%20retention%20period%3A%20Duration%20to,deleted%20after%20the%20selected%20duration

     

    Hope it helps. 
    ------------

    If you like this post, give it a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users to find it.

  • Guido Preite Profile Picture
    1,488 Super User 2024 Season 1 on at

    the problem should be the url, in your example you are calling this endpoint:

    https://testportaltrial.powerappsportals.com/_api/data/v9.0/contacts?fetchXml=

    but it should be

    https://testportaltrial.powerappsportals.com/_api/contacts?fetchXml=

    so without the /data/v9.0/ part

    hope it helps

  • Abdul-Shahied Shahid Profile Picture
    17 on at

    Thank you @GuidoPreite.

     

    It is working in my trial portal, But the error is same on client portal.

    Difference I noticed is that version of trial portal is 9.4.1.49 and

    version of client portal is 9.3.11.19

     

    Can version of client portal be a cause of error?

  • Guido Preite Profile Picture
    1,488 Super User 2024 Season 1 on at

    I don't think is a problem version, I would double check the permissions on the client portal just to make double sure the settings for the webapi are correct there (you can also use the tool inside XrmToolBox called Power Portal Web API Helper)

    hope it helps

  • Abdul-Shahied Shahid Profile Picture
    17 on at

    Hi @GuidoPreite , @ragavanrajan.

     

    I found that the Cause of error was a missing site setting that is

     

    Name:    WebAPI/enableReadOperationPreview

    Value:    True

     

    This was not mentioned in documentation. And also I could perform read operation using API without site setting mentioned above in trial portal.

     

    Thank you for your kind responses.

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Pages

#1
Jerry-IN Profile Picture

Jerry-IN 71

#2
Fubar Profile Picture

Fubar 62 Super User 2025 Season 2

#3
sannavajjala87 Profile Picture

sannavajjala87 31

Last 30 days Overall leaderboard