Json api not filtering by template id

Hi there!

I’m playing around with the json api service and I’m running in to a strange issue in my sandbox environment. I try to get contracts by query, giving an empty list for templateIds, and an empty map for query. This gives me all active contracts. Then, I copy one templateId from an active contract, and add that to my previously empty templateIds list in the request. When I submit the request a second time with that change, I still receive all active contracts in the response, regardless of templateId.

Is this intentional? Or have I done something wrong?

Also, when I use a feign client (in my spring boot middleware) to try to send the same request, with what I believe is the same body, I get “Cannot resolve any template ID from request”, so I’m not exactly sure what’s correct here!

Thank you.

1 Like

Are you sure you changed the GET to a POST? Request bodies on GET requests are ignored (that’s a general HTTP thing, not specific to the JSON API). If you want to filter by template id, you need to send a POST.

1 Like

… That’s a little embarrassing. Thank you.

For future reference, the second issue I mentioned, regarding the feign client attempting the same request: The solution was that the template Id generated by the DAML Maven plugin is not the correct format for the json api service request.

2 Likes