本文介绍了如何使用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请求?
发布评论