Want to insert item in list.

Created a List in share point app After running the code in app , getting error .

Error - Failed to load resource: the server responded with a status of 400 (Bad Request)

Please help.

$(document).ready(function () {

    AddListItem("Company 1", "IT");

    function AddListItem(Company, industryVal) {

                url: _spPageContextInfo.webAbsoluteUrl + "/_api/web/lists/GetByTitle('CompanyInfo')/items",
                type: "POST",
                data: JSON.stringify
                            type: "SP.Data.ListItem"
                        Company: Company,
                        Industry: industryVal
                    "Accept": "application/json;odata=verbose",
                    "Content-Type": "application/json;odata=verbose",
                    "X-RequestDigest": $("#__REQUESTDIGEST").val(),
                    "X-HTTP-Method": "POST"
                success: function (data, status, xhr) {
                error: function (xhr, status, error) {

  • 1
    try changing the __metadata to this: type: "SP.Data.CompanyInfoListItem" – Damjan Tomic Jan 6 '19 at 18:48

The string you are passing to type in metadata property is called as ListItemEntityTypeFullName. This property is very important while creating or updating items in SharePoint list.

You can get this property by using following REST endpoint: siteUrl/_api/Web/Lists/getbytitle('DisplayNameOfList')/ListItemEntityTypeFullName


SP.List.listItemEntityTypeFullName property

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.