Skip to content

Commit

Permalink
✨ [#4908] Implement sending result to specified endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
viktorvanwijk committed Dec 19, 2024
1 parent f43084c commit 3641483
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions src/openforms/registrations/contrib/json/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,27 @@ def register_submission(self, submission: Submission, options: OptionsT) -> None

print(values)

# TODO-4908: send `values` to the service
# Send to the service
json = {"values": values}
service = options["service"]
with build_client(service) as client:
url = f"{client.base_url}{options['relative_api_endpoint']}"
response = client.post(url, json=json, headers={"Content-Type": "application/json"})
response.raise_for_status()

# TODO-4908: does this need to be used? If so, what to put in spec?
# result = execute_unless_result_exists(
# partial(
# client.post,
# json=json,
# headers={},
# ),
# submission,
# spec="???",
# )

# TODO-4908: added return for testing purposes
return {"values": values}
return json

# TODO-4098: what to do in here?
def check_config(self):
Expand Down

0 comments on commit 3641483

Please sign in to comment.