mirror of https://github.com/zulip/zulip.git
docs: Update mentions of json_success in documentation.
Updates developer and user-facing documentation that references json_success for the addition of the request argument.
This commit is contained in:
parent
3be622ffa7
commit
c2b6e76af7
|
@ -203,8 +203,13 @@ in a
|
|||
with a content type of 'application/json'.
|
||||
|
||||
To pass back data from the server to the calling client, in the event of
|
||||
a successfully handled request, we use
|
||||
`json_success(data=<some python object which can be converted to a JSON string>)`.
|
||||
a successfully handled request, we use `json_success(request, data)`.
|
||||
|
||||
The request argument is a
|
||||
[HTTP request](https://docs.djangoproject.com/en/3.2/ref/request-response/)
|
||||
with additional metadata that Zulip associates with the request object.
|
||||
The data argument is a python object which can be converted to a JSON string
|
||||
and has a default value of an empty python dictionary.
|
||||
|
||||
This will result in a JSON string:
|
||||
|
||||
|
|
|
@ -115,7 +115,7 @@ def api_helloworld_webhook(
|
|||
# send the message
|
||||
check_send_webhook_message(request, user_profile, topic, body)
|
||||
|
||||
return json_success()
|
||||
return json_success(request)
|
||||
```
|
||||
|
||||
The above code imports the required functions and defines the main webhook
|
||||
|
@ -175,7 +175,7 @@ validate the message and do the following:
|
|||
message to the owner of the webhook bot.
|
||||
|
||||
Finally, we return a 200 http status with a JSON format success message via
|
||||
`json_success()`.
|
||||
`json_success(request)`.
|
||||
|
||||
## Step 3: Create an API endpoint for the webhook
|
||||
|
||||
|
|
Loading…
Reference in New Issue