# The API or Plugin ERROR

**URL:** <https://meta.discourse.org/t/the-api-or-plugin-error/322669>\
**Category:** Development\
**Tags:** rest-api\
**Created:** [August 21, 2024, 9:59am UTC](https://meta.discourse.org/t/the-api-or-plugin-error/322669 "2024-08-21T09:59:51Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![yangxuan](https://avatars.discourse-cdn.com/v4/letter/y/8e8cbc/32.png) [@yangxuan](https://meta.discourse.org/u/yangxuan)\
**Post date:** [August 21, 2024, 10:11am UTC](https://meta.discourse.org/t/the-api-or-plugin-error/322669/3 "2024-08-21T10:11:46Z")

</div>

I wrote the following query statement using PostgreSQL, then called the PostgreSQL statement with an API, and when I clicked those two buttons, an error occurred.

SELECT  
u.username,  
g.name AS group\_name  
FROM  
Users u  
JOIN  
Groups g  
ON  
u.primary\_group\_id = g.id  
WHERE  
u.username = ‘yangxuan’

SELECT  
username,  
array\_agg(id) AS ids  
FROM  
Users  
GROUP BY  
username  
HAVING  
COUNT(id) \> 1;

---

_[View the full topic](https://meta.discourse.org/t/the-api-or-plugin-error/322669)._
