Comments (6)
Hi Bruce,
You probably have an error in the item data type. It likely to be "SP.Data.DemandesListItem".
Also, I've found out that POST request body was not treated in proxy, has applied some changes.
Could you please check if ver. 1.1.10 will work for you?
P.S. POST requests won't work the same as on a SharePoint page. E.g. X-RequestDigest is requested automatically by the lib, but on a real SharePoint page should be provided explicitly within ajax request. So it's better to check such request setup in the real environment.
from sp-rest-proxy.
Hi, no better with { '__metadata': { 'type': 'SP.Data.DemandesListItem' }, 'Title': 'Test' } in 1.1.10
I get a 404 in the console:
jquery.min.js:4 POST http://localhost:8080/%7B%20'__metadata':%20%7B%20'type':%20'SP.Data.DemandesListItem'%20%7D,%20'Title':%20'Test'%20%7D 404 (Not Found)
Response error:
{
"readyState": 4,
"responseText": "Cannot POST /%7B%20'__metadata':%20%7B%20'type':%20'SP.Data.DemandesListItem'%20%7D,%20'Title':%20'Test'%20%7D\n",
"status": 404,
"statusText": "Not Found"
}
Now I know it's normal I have to run it on the sharepoint server!
from sp-rest-proxy.
When I run it on the sharepoint server I get:
Uncaught SyntaxError: Unexpected end of JSON input
at JSON.parse (<anonymous>)
at HTMLButtonElement.<anonymous> (script.js:59)
at HTMLButtonElement.dispatch (jquery.min.js:3)
at HTMLButtonElement.r.handle (jquery.min.js:3)
from sp-rest-proxy.
Bruce,
It looks like you are doing something wrong withing your request.
Data object shouldn't go to the URL string. It should be a list items endpoint provided as an URL.
It works for me in embedded client page:
and with a $.ajax call:
$.ajax({
url: '/_api/web/getList(\'/sites/dev01/Lists/Custom02\')/items',
// endpoint should be correct one with the exception of the web url
// which is injected with the proxy automatically from the context setup
method: 'POST',
contentType: "application/json;odata=verbose",
data: JSON.stringify({
"__metadata": { "type": "SP.Data.Custom02ListItem" },
"Title": "Created from proxy"
}),
success: function(d) { console.log(d); },
error: function(e) { console.log(e.responseText); }
});
and on SharePoint page too:
As you can see, request on the SP page should have some additional setup to include digest, etc., which can be omitted during querying too the proxy.
from sp-rest-proxy.
yes it works!!!!
thank you so much!
now I have to find the way to call it from my ReactJS app
from sp-rest-proxy.
Always welcome, cheers!
from sp-rest-proxy.
Related Issues (20)
- Identical requests - succeeding and failing HOT 4
- Can this react app be deployed as a web app on to a windows server so that users can access the app outside of the server ? HOT 6
- Host "sp-rest-proxy" as an independent web-app on Azure or pass authentication in configs to be used in CI/CD pipeline HOT 1
- Can this proxy be used when the host SP environment (on prem) has a "strict-origin-when-cross-origin" HTTP referrer policy? HOT 3
- sharepoint MFA bypass HOT 2
- [Feature query] Can the proxy be made to connect to multiple sites? HOT 1
- sp-rest-proxy with sharepointplus HOT 10
- POST request fails when calling the proxy (adding extra path to sharepoint request) HOT 5
- Proxy Error: Cannot read properties of null (reading 'toString') (see more in sp-rest-proxy console) HOT 4
- Version 3.3.4 broken for OnpremiseUserCredentials HOT 5
- Cannot read properties of null (reading 'toString') HOT 3
- On Demand - cannot read properties of null / childprocess.spawnsync EONENT Error HOT 2
- Proxy approach for Azure Active Directory HOT 2
- Typescript import HOT 1
- Setting siteUrl programatically HOT 4
- sp-rest-proxy does not work with Node 18.16.0 (current LTS) HOT 5
- Thank you HOT 1
- Docker HOT 2
- JSOM using sp-rest-proxy / clarification needed HOT 9
- 401 When Running in Docker HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sp-rest-proxy.