# Loading tenant option in microservice

**URL:** <https://community.cumulocity.com/t/loading-tenant-option-in-microservice/7078>\
**Category:** Forum\
**Tags:** device-connectivity, cumulocity\
**Created:** [March 5, 2024, 8:54am UTC](https://community.cumulocity.com/t/loading-tenant-option-in-microservice/7078 "2024-03-05T08:54:00Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![rushikesh\_n](https://avatars.discourse-cdn.com/v4/letter/r/c57346/32.png) [@rushikesh\_n](https://community.cumulocity.com/u/rushikesh_n)\
**Post date:** [March 5, 2024, 8:54am UTC](https://community.cumulocity.com/t/loading-tenant-option-in-microservice/7078/1 "2024-03-05T08:54:00Z")

</div>

c8y\_backend version:  
1020.73.0

Problem statement:  
when the Microservice is restarted, I want to use a specific Tenant Option to load the configured authentication

---

<div class="post-metadata">

**Author:** ![Korbinian\_Butz](https://dub1.discourse-cdn.com/flex005/user_avatar/community.cumulocity.com/korbinian_butz/32/10473_2.png) [@Korbinian\_Butz](https://community.cumulocity.com/u/Korbinian_Butz)\
**Post date:** [March 5, 2024, 9:28am UTC](https://community.cumulocity.com/t/loading-tenant-option-in-microservice/7078/2 "2024-03-05T09:28:24Z")

</div>

Hi,

could you explain a bit more what you want to achieve and why? Is it that you have an existing tenant option and you just want to read/query it? Which programming language are you using?

---

<div class="post-metadata">

**Author:** ![rushikesh\_n](https://avatars.discourse-cdn.com/v4/letter/r/c57346/32.png) [@rushikesh\_n](https://community.cumulocity.com/u/rushikesh_n)\
**Post date:** [March 5, 2024, 9:50am UTC](https://community.cumulocity.com/t/loading-tenant-option-in-microservice/7078/3 "2024-03-05T09:50:01Z")

</div>

I am doing a poc, in which there are existing tenant options available in the tenant I want to load a specific tenant eg having category:“xyz-api” in the App.java file. I don’t have any idea how it can be done.

Programming Language: Java

---

<div class="post-metadata">

**Author:** ![Robert\_Neale](https://dub1.discourse-cdn.com/flex005/user_avatar/community.cumulocity.com/robert_neale/32/31965_2.png) [@Robert\_Neale](https://community.cumulocity.com/u/Robert_Neale)\
**Post date:** [March 5, 2024, 9:52am UTC](https://community.cumulocity.com/t/loading-tenant-option-in-microservice/7078/4 "2024-03-05T09:52:08Z")

</div>

REST call from the microservice?

This from the documentation…

“Moreover, the options can be fetched via REST using the options endpoint at microservice runtime.”

---

<div class="post-metadata">

**Author:** ![rushikesh\_n](https://avatars.discourse-cdn.com/v4/letter/r/c57346/32.png) [@rushikesh\_n](https://community.cumulocity.com/u/rushikesh_n)\
**Post date:** [March 5, 2024, 9:54am UTC](https://community.cumulocity.com/t/loading-tenant-option-in-microservice/7078/5 "2024-03-05T09:54:26Z")

</div>

yes, but how do I load it at microservice runtime

---

<div class="post-metadata">

**Author:** ![Stefan\_Witschel](https://dub1.discourse-cdn.com/flex005/user_avatar/community.cumulocity.com/stefan_witschel/32/31955_2.png) [@Stefan\_Witschel](https://community.cumulocity.com/u/Stefan_Witschel)\
**Post date:** [March 5, 2024, 10:00am UTC](https://community.cumulocity.com/t/loading-tenant-option-in-microservice/7078/6 "2024-03-05T10:00:26Z")

</div>

Here is an example how this can be done: [cumulocity-microservice-templates/secret at main · Cumulocity-IoT/cumulocity-microservice-templates · GitHub](https://github.com/Cumulocity-IoT/cumulocity-microservice-templates/tree/main/secret)

Also in the docs you can find an example: [Microservice SDK for Java - Cumulocity documentation](https://cumulocity.com/docs/microservice-sdk/java/#microservice-settings)

---

<div class="post-metadata">

**Author:** ![rushikesh\_n](https://avatars.discourse-cdn.com/v4/letter/r/c57346/32.png) [@rushikesh\_n](https://community.cumulocity.com/u/rushikesh_n)\
**Post date:** [March 5, 2024, 10:05am UTC](https://community.cumulocity.com/t/loading-tenant-option-in-microservice/7078/7 "2024-03-05T10:05:56Z")

</div>

@Stefan_Witschel Thanks for helping

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/flex005/user_avatar/community.cumulocity.com/system/32/31990_2.png) [@system](https://community.cumulocity.com/u/system)\
**Post date:** [September 1, 2024, 10:06am UTC](https://community.cumulocity.com/t/loading-tenant-option-in-microservice/7078/8 "2024-09-01T10:06:55Z")

</div>

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.
