# /rules/search?languages=c# or /rules/search?languages=csharp

**URL:** <https://community.sonarsource.com/t/rules-search-languages-c-or-rules-search-languages-csharp/11201>\
**Category:** SonarQube Server / Community Build\
**Created:** [June 26, 2019, 2:00pm UTC](https://community.sonarsource.com/t/rules-search-languages-c-or-rules-search-languages-csharp/11201 "2019-06-26T14:00:04Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![RyanK](https://avatars.discourse-cdn.com/v4/letter/r/bc79bd/32.png) [@RyanK](https://community.sonarsource.com/u/RyanK)\
**Post date:** [June 26, 2019, 2:00pm UTC](https://community.sonarsource.com/t/rules-search-languages-c-or-rules-search-languages-csharp/11201/1 "2019-06-26T14:00:04Z")

</div>

SonarQube Community Edition v7.7.23042

I am trying to access the SQ API to extract the rules for our compliance and audit reports.  
With the same credentials I am able to see it through the UI

I am not able to extract C# rules  
Rules = Invoke-RestMethod -Headers {header} -Uri “${SONARQUBEDOMAIN}/sonar/api/rules/search?languages=csharps” -Method Get;

![image](https://europe1.discourse-cdn.com/sonarsource/uploads/sonarcommunity/original/2X/0/02901c81ebac7a6ae077fbba0813ba5c75ce9783.png)

I am able to get Java rules.  
Rules = Invoke-RestMethod -Headers {header} -Uri “${SONARQUBEDOMAIN}/sonar/api/rules/search?languages=Java” -Method Get;

 ![image](https://europe1.discourse-cdn.com/sonarsource/uploads/sonarcommunity/original/2X/6/641d4e8d90d18b7ceefedb35517118e1b637076d.png)

---

<div class="post-metadata">

**Author:** ![felipebz](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/felipebz/32/32739_2.png) [@felipebz](https://community.sonarsource.com/u/felipebz)\
**Post date:** [June 26, 2019, 4:41pm UTC](https://community.sonarsource.com/t/rules-search-languages-c-or-rules-search-languages-csharp/11201/2 "2019-06-26T16:41:08Z")

</div>

Hi.

The correct id for C# is `cs`. Please use `....api/rules/search?languages=cs`

---

<div class="post-metadata">

**Author:** ![RyanK](https://avatars.discourse-cdn.com/v4/letter/r/bc79bd/32.png) [@RyanK](https://community.sonarsource.com/u/RyanK)\
**Post date:** [June 26, 2019, 6:12pm UTC](https://community.sonarsource.com/t/rules-search-languages-c-or-rules-search-languages-csharp/11201/3 "2019-06-26T18:12:35Z")

</div>

Hi Felipe  
Yes that works. Thanks

Can you provide the documentation on what is the language key I can use for each language SQ scans against?

The highlight would be the current preference, I would like to create a report for all the languages  
 ![image](https://europe1.discourse-cdn.com/sonarsource/uploads/sonarcommunity/original/2X/d/d8ab514cea8bc094301773b8fa0b39a17fa7d01e.png)

---

<div class="post-metadata">

**Author:** ![felipebz](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/felipebz/32/32739_2.png) [@felipebz](https://community.sonarsource.com/u/felipebz)\
**Post date:** [June 26, 2019, 6:35pm UTC](https://community.sonarsource.com/t/rules-search-languages-c-or-rules-search-languages-csharp/11201/4 "2019-06-26T18:35:12Z")

</div>

Unfortunately I’m not sure if it’s documented anywhere. I went to the “Rules” page, selected the language and looked at the URL. 😃
