Add React Web API create-record sample#90
Draft
MrRishabhJain wants to merge 1 commit into
Draft
Conversation
Add a focused, single-purpose SPA code-site sample that creates a Dataverse record via the Power Pages Web API (HTTP POST), covering the anti-forgery token, OData headers, Web API site settings, and a Create table permission. Also surface the previously-undocumented server-logic category in the READMEs and list the new sample in the root and SPA sample tables. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this does
Adds a new, single-concept SPA code-site sample: Web API: Create a Record
(
samples/spa/react/web-api-create-record/).It demonstrates exactly one thing — how to create a Dataverse record from a
Power Pages code site using the Web API (HTTP
POST) — in keeping with thegoal of samples that are easy for a human developer to follow.
Why
The existing Web API coverage across the repo is read-heavy: every sample shows
GET, and the only write (PATCH) is buried inside the full Credit Cardsbanking app. There was no focused, copy-pasteable example of creating a record,
which is one of the most common things customers ask for. This sample isolates
that concept.
What's in the sample
src/api/webApi.ts:/_layout/tokenhtml),POSTto/_api/sample_feedbackswith the OData headers,OData-EntityIdresponse header.FeedbackForm.tsx) — no UI framework,just React + Vite + TypeScript to keep the signal high.
npm run devis explorable without a deployed site.table schema, the Web API site settings, and the Create table
permission (including the HTTP 403 path when it's missing).
Discoverability fixes
README.mdandsamples/spa/README.mdtables.server-logiccategory: newsamples/server-logic/README.mdand a row in the root README for theexisting SharePoint Integration sample.
Verification
npm installandnpm run build(stricttsc+ Vite) pass.screenshot.pngis a real capture of the running app.node_modules/distare gitignored; only source files are tracked.Notes
.powerpages-site/metadata shell(it carries site-specific GUIDs and can't be validated without a live org).
pac pages upload-code-siteregenerates that shell; the meaningful Power Pagesconfiguration is documented in the sample README instead.
Opened as a draft for early feedback on the approach. If the direction is
good, I have follow-up single-concept samples queued: file upload/download,
trigger a Power Automate flow, and a table-permissions sample.
Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com