Title: How to handle POST requests with JSON payload in the body? · Issue #11 · WolframResearch/WolframWebEngineForPython · GitHub
Open Graph Title: How to handle POST requests with JSON payload in the body? · Issue #11 · WolframResearch/WolframWebEngineForPython
X Title: How to handle POST requests with JSON payload in the body? · Issue #11 · WolframResearch/WolframWebEngineForPython
Description: Here is simple example of what I am doing: APIFunction[ {}, If[HTTPRequestData["Method"] === "GET", "400 Bad Request", ExportForm[HTTPRequestData["Body"], "JSON"] ]& ] I pass the following JSON object to the endpoint: { x: 1, y: 2, z: 3 ...
Open Graph Description: Here is simple example of what I am doing: APIFunction[ {}, If[HTTPRequestData["Method"] === "GET", "400 Bad Request", ExportForm[HTTPRequestData["Body"], "JSON"] ]& ] I pass the following JSON obj...
X Description: Here is simple example of what I am doing: APIFunction[ {}, If[HTTPRequestData["Method"] === "GET", "400 Bad Request", ExportForm[HTTPRequestData["Body"], &q...
Opengraph URL: https://github.com/WolframResearch/WolframWebEngineForPython/issues/11
X: @github
Domain: patch-diff.githubusercontent.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"How to handle POST requests with JSON payload in the body?","articleBody":"Here is simple example of what I am doing:\r\n\r\n```\r\nAPIFunction[\r\n {},\r\n If[HTTPRequestData[\"Method\"] === \"GET\",\r\n \"400 Bad Request\",\r\n ExportForm[HTTPRequestData[\"Body\"], \"JSON\"]\r\n ]\u0026\r\n]\r\n```\r\n\r\nI pass the following JSON object to the endpoint:\r\n\r\n```\r\n{\r\n x: 1,\r\n y: 2,\r\n z: 3\r\n}\r\n```\r\n\r\nI have tried using postman, insomnia and fetch function in javascript to send the payload. All of them complain Expression \"None\" cannot be exported as JSON. Upon closer inspection, I found that HTTPRequestData[\"Body\"] remains None for some reason. \r\n\r\nWhat would be the best way to deal with JSON payloads in POST requests? It may be helpful to know that the above function works fine when deployed in Wolfram Application Server.","author":{"url":"https://github.com/s4m13337","@type":"Person","name":"s4m13337"},"datePublished":"2024-03-24T08:51:42.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/11/WolframWebEngineForPython/issues/11"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:290a9ba1-9015-7f5f-5b2d-77fd9b2503fa |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B268:13337B:1639625:1F2D916:69821ED5 |
| html-safe-nonce | 7e06bb5f16950feeecb0576cda8c023c6ddad18272cb98058696e2676908adcb |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCMjY4OjEzMzM3QjoxNjM5NjI1OjFGMkQ5MTY6Njk4MjFFRDUiLCJ2aXNpdG9yX2lkIjoiOTIyMjkyNTE5ODgxNzM2OTgxMyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | f52199826c786f7e21012b7ae6969e51dd4532eede19329777ceeb8b400ddc51 |
| hovercard-subject-tag | issue:2204249887 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/WolframResearch/WolframWebEngineForPython/11/issue_layout |
| twitter:image | https://opengraph.githubassets.com/9b39eec9555377911022bbc9a2a37c8d3556912eff61d821c48c6348411441e6/WolframResearch/WolframWebEngineForPython/issues/11 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/9b39eec9555377911022bbc9a2a37c8d3556912eff61d821c48c6348411441e6/WolframResearch/WolframWebEngineForPython/issues/11 |
| og:image:alt | Here is simple example of what I am doing: APIFunction[ {}, If[HTTPRequestData["Method"] === "GET", "400 Bad Request", ExportForm[HTTPRequestData["Body"], "JSON"] ]& ] I pass the following JSON obj... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | s4m13337 |
| hostname | github.com |
| expected-hostname | github.com |
| None | c5d01132ac10b0b45b88f4c1c8790502d669eb065ff383dc5e4757c174f3380f |
| turbo-cache-control | no-preview |
| go-import | github.com/WolframResearch/WolframWebEngineForPython git https://github.com/WolframResearch/WolframWebEngineForPython.git |
| octolytics-dimension-user_id | 11549616 |
| octolytics-dimension-user_login | WolframResearch |
| octolytics-dimension-repository_id | 207578815 |
| octolytics-dimension-repository_nwo | WolframResearch/WolframWebEngineForPython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 207578815 |
| octolytics-dimension-repository_network_root_nwo | WolframResearch/WolframWebEngineForPython |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | fabca968a4d0c1d630cbf4ea410949b58bc6bd54 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width