Al - Hi, I'm trying to call this API via C# cod...
Hi, I'm trying to call this API via C# code. I tested it in Postman, and it only accepts x-www-form-urlencoded, throwing an error when I use JSON. My issue is that I need to pass an array of strings, and despite serializing the ids part as a string[], I’m still getting a 500 error from the server.
Additionally, I found that the API only works with callosum/v1 included in the URL, which makes the documentation a bit unclear.
Do you have an example of how to handle this in C#?

Solution:Jump to solution
The userId that you gave is supposed to be userid, can you check once using that? Also I gave this curl to chatgpt
to code for C# this is what is produced :
```...
18 Replies
I might need to check this, but does ids=['guid1','guid2'] does not work? Can you check how the data is being sent in the request in C#? It should be language agnostic if the request being formed is correct
Also both in the request URL and in the cURL url we have callosum/v1 included in URL, the resource URL is just to understand the endpoint (since every v1 endpoint will have callosum/v1 as its prefix we have not included it in the endpoint URL) rather than full URL, we have request url given there.
Can you suggest how to improve the documentation here?
no it does not work because in C#, to pass something as x-www-form-urlencoded, you need to use FormUrlEncodedContent which takes a KeyValuePair<string, string>. The parameter ids is setup to be an array of id. This is what makes it complicated.
As far as the doc is concern, I guess you could just include callosum/v1 in everything for consistency. But that's just me. Anyway, it's a minor thing. I just want to be able to get the API to work.
btw this is what my request content looks like. Still throws a 500 error from the server

here's the full method for your reference


here's the error I get

@pallav can you check this?
Hello, I just wanted to kindly follow up on this.
nvm let me check how to do this for C#
yes please, thank you
Solution
The userId that you gave is supposed to be userid, can you check once using that? Also I gave this curl to chatgpt
to code for C# this is what is produced :
let me know if this helps
so the ids parameter expects a string[], but what if I only pass one? it's not gonna treat it as array
no it won't. Though just giving a single element in the array should work
new KeyValuePair<string, string>("ids", "['fded567b-8047-4185-b702-cee652725ac7']"),
should be fine
tried it. it doesn't work. here's the error

I wish we can just get it to accept json, is that not possible?
here's what the param looks like

actually, it works. Didn't notice that I had the I in userId as uppercase
thanks for the help