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

On Wed, Mar 27, 2024 at 9:56 AM 刘天明 <tianming2w...@gmail.com> wrote:

> 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"}
>
> --
> 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+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/reviewboard/fcfd5f09-1f8b-4b8f-a3d3-f5952c449f15n%40googlegroups.com
> <https://groups.google.com/d/msgid/reviewboard/fcfd5f09-1f8b-4b8f-a3d3-f5952c449f15n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/reviewboard/CAFS3VNXDa%3DkaTPYe%2BxgAKVcvv8h%2BmgjQmViT%2BQe1b-EBoouf3A%40mail.gmail.com.

Reply via email to