#client side library REST API .....

1 messages · Page 1 of 1 (latest)

nocturne yew
#

I hope you're doing well! I have a question regarding the use of Payload on the client side. When working on the client side, I understand that using the REST API is a must. However, I'm wondering if there is an auto-generated library, similar to getPayload, but not for the server side (local API)?

Any help or pointers would be greatly appreciated. Thanks in advance!

rough oysterBOT
sharp fossil
#

We’re actively working on a Payload SDK (REST Client) to do exactly this. It will mimic the Local API but will use the REST API under the hood and provide full type safety. Details here: https://github.com/payloadcms/payload/pull/9463

GitHub

Adds Payload SDK package, which can be used to query Payload REST API in a fully type safe way. Has support for all necessary operations, including auth, type safe select, populate, joins propertie...

#

Any reason why you wouldn’t simply use the Local API on the server?

nocturne yew
#

If I ever find myself needing to use the API, I’d prioritize the Local API first and only consider the REST API as a last resort. Initially, I thought about converting the Local API to a server action, but then realized it might not make sense when the REST API is already available.

Thanks for the amazing CMS and all the hard work your team puts into it!

rough oysterBOT