Cant not use rest api create repository

15 views
Skip to first unread message

刘天明

unread,
Mar 27, 2024, 11:56:12 AMMar 27
to Review Board Community
Why this is marked as abuse? It has been marked as abuse.
Report not abuse
ReviewBoard version: 6.0.2
i wan use rest api create repository
document:https://www.reviewboard.org/docs/manual/6.x/webapi/2.0/resources/repository-list/#POST

the request use crul:

curl --location --request POST 'https://reviewboard.xxxxxx.com/api/repositories/' \
--header 'Authorization: token xxxxx' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--data-raw '{"name": "test","tool": "git"}'
thre response from server:
{"err": {"code": 105, "msg": "One or more fields had errors", "type": "request-field-error"}, "fields": {"name": ["This field is required"], "tool": ["This field is required"]}, "stat": "fail"}

David Trowbridge

unread,
Apr 1, 2024, 12:42:57 AMApr 1
to revie...@googlegroups.com
Why this is marked as abuse? It has been marked as abuse.
Report not abuse
When sending data to the API, you need to use form-data rather than JSON. So your curl call would look more like:

curl ...args.  -F name=test -F tool=git

--
Supercharge your Review Board with Power Pack: https://www.reviewboard.org/powerpack/
Want us to host Review Board for you? Check out RBCommons: https://rbcommons.com/
Happy user? Let us know! https://www.reviewboard.org/users/
---
You received this message because you are subscribed to the Google Groups "Review Board Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to reviewboard...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/reviewboard/fcfd5f09-1f8b-4b8f-a3d3-f5952c449f15n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages