【发布时间】:2021-12-19 07:34:40
【问题描述】:
我正在尝试在 java 中发布 api.discogs.com/marketplace/listings?...。
当我尝试发布新列表帖子时,结果是“返回了 422 null 的响应状态”。
"422 无法处理的实体 您的请求格式正确,但请求正文在语义上存在问题。这可能是由于 JSON 格式错误、参数丢失或类型错误,或者尝试执行没有任何意义的操作。查看响应正文,了解有关问题的具体信息。”
“Invalid release_id:expected integer”显示为消息。
我的 get 方法有效,但 post 无效。
int release_id;
String condition;
int listing_id;
String sleeve_condition;
String comments;
String allow_offers;
string status;
String external_id;
String location;
string weight;
String format_quantity;
private Double price = Double.valueOf(0);
json = doPost("/marketplace/listings?release_id=" + product.getRelease_id() + "&sleeve_condition=" + product.getCondition() + "&price=" +product.getPrice());
"https://api.discogs.com/marketplace/listings?release_id=1113859&condition=poor&price=2000.0&status=Mint"
WebResource webResource = initRest(restUrl);
ClientResponse resp = webResource.type("application/json")
.header("Authorization", "Discogs token=" + token)
.header("JTLSyncTool/0.1", "+https://#####")
.post(ClientResponse.class);
有人有想法吗?
谢谢大家!
【问题讨论】:
-
请显示有效的POST字符串(
doPost()的参数值)! -
请修正您问题中的 Java 代码!
标签: java post postdata discogs-api javahelp