如何使用ORDS发出POST请求?

编程入门 行业动态 更新时间:2024-10-22 21:20:18
本文介绍了如何使用ORDS发出POST请求?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我想在ORDS应用程序Express中插入一个带有POST请求的新项目.

I want to insert a new item with a POST request in ORDS application express.

我是这样创建我的处理程序的:

I created my handler like this :

然后在android studio中,我使用volley创建一个JSONObject(&同时请求):

Then with android studio, I use volley to create a JSONObject (& the request at the same time) :

JSONObject jsonBody = new JSONObject(); jsonBody.put("name", name); jsonBody.put("genres", genres); jsonBody.put("season", season); jsonBody.put("episodes", nb_episodes); jsonBody.put("rating", "0"); final String requestBody = jsonBody.toString();

我也与邮递员一起尝试了此请求:

I also tried this request with postman :

如您所见,我得到一个错误500,但我找不到问题.如果我在SQL命令中执行查询,则可以正常运行:

As you can see, I get a error 500 and I can't find the problem. If I do the query in SQL command, it works fine :

Insert into android_anime (name, genres, season, nb_episode, rating) Values ('anime5', 'G6', 2, 24, 5)

我该怎么做才能使我的帖子请求正常工作?

What should I do to make my post request work?

编辑

这是表格定义:

CREATE TABLE "ANDROID_ANIME" ( "ID" NUMBER, "NAME" VARCHAR2(30), "GENRES" VARCHAR2(30), "SEASON" NUMBER, "NB_EPISODE" NUMBER, "RATING" NUMBER, CONSTRAINT "ANDROID_ANIME_PK" PRIMARY KEY ("ID") USING INDEX ENABLE )

推荐答案

我对表定义的猜测.

SQL> create table android_anime( 2 name varchar2(200), 3 genres varchar2(200), 4 season number, 5 nb_episode number, 6* rating number); Table ANDROID_ANIME created.

从未使用过Volley,但这里是基本的网址

Never used Volley but here's basic cUrl

## anime-lowercase curl -X "POST" "apex.oracle/pls/apex/dbtools/test/postAnime" \ -H 'Content-Type: application/json' \ -d $'{ "genres": "G6", "season": "1", "name": "anime-99", "nb_episode": "1", "rating": "1" }'

其余的定义.

更多推荐

如何使用ORDS发出POST请求?

本文发布于:2023-06-05 19:39:42,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/526451.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:如何使用   ORDS   POST

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!