Here is the detailed documentation for the lists and their features.
There are multiple ways to create a list item, here I’m sharing the REST API Code.
Steps to Create the SP List Item
Follow the below listed steps to Create an item.
Step 1
Create one JS file or you can use the Content Editor Web Part.
Step 2
Below is the API to get the particular list, you can browse this URL in the browser to check whether the API is working or not.
https://sharepoint.com/_api/web/lists/GetByTitle('samplelist')/items
Note
Replace your list name with “samplelist”.
Step 3
Refer to the jQuery in your HTML file or CEWP.
Use the below code to Create an item in a SharePoint list.
- 'use strict';
- ExecuteOrDelayUntilScriptLoaded(initializePage, "sp.js");
- function initializePage() {
- var siteURL;
- // This code runs when the DOM is ready and creates a context object which is needed to use the SharePoint object model
- $(document).ready(function() {
- var scriptbase = _spPageContextInfo.webServerRelativeUrl + "/_layouts/15/";
- CreateListItem();
- });
- //Retrieve list items from sharepoint using API
- function CreateListItem() {
- siteURL = _spPageContextInfo.webAbsoluteUrl;
- console.log("from top nav - " + siteURL);
- var apiPath = siteURL + "/_api/lists/getbytitle(''samplelist'')/items";
- $.ajax({
- url: apiPath,
- type: "POST",
- headers: {
- Accept: "application/json;odata=verbose"
- },
- data: "{__metadata:{'type':'SP.Data.YourlistnameListItem'},Title:”Ur input "
- }
- ",
- async: false, success: function(data) {
- alert("Item is Created successfully!!");
- }, eror: function(data) {
- console.log("An error occurred. Please try again.");
- }
- });
- }
- }
Summary
In this blog, we have explored how to create an item in the SharePoint list using REST API. Happy Coding!!

suresh vegapattaPosted Apr 1, 2019, 12:22 AM
Hi Kaviya, I am getting 'Access denied. You do not have permission to perform this action or access this resource' error while trying to access list items through an rest api. All my permissions are set. Any idea on this?
Viknaraj ManogararajahPosted Jul 19, 2018, 6:49 AM
Nice Article...........
Mahesh VermaPosted Jun 21, 2018, 11:42 AM
Nice article.....