Back

How to access body_row keys

  • 0
  • Functions
Kenon
25 Sep, 2023, 23:19

I had to do this sort of code to get to the keys and the value of the body. Is this completely normal? body = context.req.body_raw match = re.match(r"{\s*(\w+):\s*(\w+)\s*}", body)

Body or body row is not a json, How did you plan to reach the keys?

The documentation doesn't help

thanks for the help

TL;DR
To access body_row keys, you should use `req.body` instead of `req.bodyRaw`. You can find more information about the `req` variable in the documentation here: [link]. There is also a usage example available here: [link]. If you are having trouble executing the function, you can try using the following code to access the keys and values of the body: ``` body = context.req.body_raw match = re.match(r"{\s*(\w+):\s*(\w+)\s*}", body) ``` It is not normal for body or body row to not be in JSON format. If
Drake
26 Sep, 2023, 01:29

What is body_raw and how are you executing the function?

Kenon
26 Sep, 2023, 07:31

I just found a usage example here: https://appwrite.io/docs/functions-examples

I'll try to see if it works

Guille
26 Sep, 2023, 12:05

You can check more information about the req var here: https://appwrite.io/docs/functions-develop#request

Guille
26 Sep, 2023, 12:05

you should use req.body instead of req.bodyRaw

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more