koltyakov / sp-rest-proxy

🌐 SharePoint API Proxy for local development
MIT License
172 stars 43 forks source link

OData mode question #82

Closed kchiragowni closed 5 years ago

kchiragowni commented 5 years ago

Hello @koltyakov, Great tool and very handy for developing apps locally! I have tried making REST call on SP 2013 and was able to get the data if odata=verbose but no luck with odata as 'minimal' or 'nometadata'. Any idea? Thanks

koltyakov commented 5 years ago

Hi @kchiragowni,

Thanks for the good words!

In SP2013, by default, there are no OData modes other than verbose. It's not about the proxy but a server-side setting.

In SP2013, it's possible to install WCF OData extensions to add OData modes support.

I personally prefer sticking to verbose with SP2013, cause any server-side changes are expensive in maintenance and *Ops aspects.

kchiragowni commented 5 years ago

Thanks for the swift response @koltyakov, and yes I thought that would be the case with SP2013. I totally agree with you in respect to installing extensions, but we are bit concerned about 'verbose' payload. Would you suggest anything to minimize the payload? Thanks again!

koltyakov commented 5 years ago

In many cases sizewise payload in verbose mode is ok. I've never faced any issues with that during all of these years working with SharePoint.

The common practice is minifying payload by fetching only data which is only required (using $select=).

The greater concern to be aware of is that based on the OData mode the payload "shape" is different and the migration of the app to a newer version of SharePoint or SPO and more effective OData modes might introduce some bugs. Luckily, it's possible using API wrappers such as PnPjs and do not bother about the payload and REST API nuances most of the time.

An offtopic, but can recommend sppp generator for SP2013, all the things including PnPjs, sp-rest-proxy + dev server, context binding and more is there just from OOTB.

kchiragowni commented 5 years ago

That's great, I appreciate your input. I will explore sppp generator.

BTW 'Merge' operation didn't work with Postman for SP2013, however it worked from the app though. Thought worth highlighting.

koltyakov commented 5 years ago

Could you please elaborate 'Merge' case in a separate issue (appreciate getting a sample to repro)? If something wrong and behaves differently rather than while being executed in SP context, I'd fix this and include a test case.