How to check if there are enough resources(cpu, memory) allocated to the pod, before create a pod through RestAPI?

How to check if there are enough resources(cpu, memory) allocated to the pod, before create it through RestAPI?

Scenes:
We have several dedicated nodes just allocated for a kind of POD(per user per pod),
first. we want know if there are enough resources(cpu, memory) allocated to the pod, before create it(through Rest API)
second. we want creation failed(not “Pending”) if there are no enough resources to allocated (through Rest API)
How do we achieve through the interface(k8s Rest API)?

Cluster information:

Kubernetes version: v1.18.8
Cloud being used: aliyun
Installation method: kubadmin
Host OS: Ubunutu

Any body can help?