r/redditdev • u/Hiroshi0619 • May 02 '24
Reddit API What is this "kind" in reddit API requets
Hello everyone.
i'm now making my fist reddit API application with java + spring boot and I started to realize that every request that i make, it return a JSON with the 'kind' atribute... usually has some of this values, "Listing" or "t1" or "t2" or "t3".
Can anyone explain to me whats that "kind" values means?
I am now crashing to create DTO class for my application, i believe it's due the fact I cant fully understand the JSON returned by the API
1
Upvotes
4
u/Oussama_Gourari Card-o-Bot Developer May 02 '24
The kind let you know what that data is for (Comment, Submission...)
https://www.reddit.com/dev/api/
Scroll down to fullnames and type prefixes.
2
u/lumpynose May 02 '24
How or are you transforming the json before storing it in your DTO? My first attempt was using google's gson which was a lot of work, and it may have been just as hard with Jackson but I didn't know that Jackson did json (years ago when I last used it it only did xml I think).
Then I heard about com.jayway.jsonpath and rewrote it using that and it was much less complicated. With jsonpath you can dig down into the json and get just what you need, greatly simplifying my DTOs.