We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sp-request/test/integration/integration.spec.ts
Line 168 in 9f3b27d
Hi, I'm using this module, and he is amazing, but in my tests i'm getting Response Code 400 when create a new item in list....
After some hours and thousands of Chrome tabs in Stackoverflow, i did not find any reference about possible incorrect _metadata type format.
Then, i test parsing _metadata like this: body: { "__metadata": { "type": "SP.List" }, "Title": "New Item" },
body: { "__metadata": { "type": "SP.List" }, "Title": "New Item" },
And error 400 no more occours....
If you wan't to try or put this in your documentation can be very helpfull for income users.
Here's my full code for consultant:
const spClient = sprequest.create({ username, password }) spClient.requestDigest(url).then(digest => { return spClient.post(`${url}/_api/web/lists/getByTitle('nodejsapp')/items `, { body: { "__metadata": { "type": "SP.List" }, "Title": "New Item" }, headers: { 'X-RequestDigest': digest } }) }).then(function () { console.log('item just created!!!'); }, function (err) { // if (err.message.indexOf('-2130575342') === -1) { // console.log('Hmmmmm something went wrong'); // console.log(err); // return; // } // console.log('list already exists!!!'); }) .catch(function (err) { console.log('Hmmmmm something went wrong'); console.log(err); });
The text was updated successfully, but these errors were encountered:
No branches or pull requests
sp-request/test/integration/integration.spec.ts
Line 168 in 9f3b27d
Hi,
I'm using this module, and he is amazing, but in my tests i'm getting Response Code 400 when create a new item in list....
After some hours and thousands of Chrome tabs in Stackoverflow, i did not find any reference about possible incorrect _metadata type format.
Then, i test parsing _metadata like this:
body: { "__metadata": { "type": "SP.List" }, "Title": "New Item" },
And error 400 no more occours....
If you wan't to try or put this in your documentation can be very helpfull for income users.
Here's my full code for consultant:
The text was updated successfully, but these errors were encountered: