# Not able to get usid using getenv("CONFD\_MAAPI\_USID")

**URL:** <https://dmap-community.ductus.global/t/not-able-to-get-usid-using-getenv-confd-maapi-usid/1507>\
**Category:** Core Engine and APIs\
**Created:** [September 1, 2017, 6:17am UTC](https://dmap-community.ductus.global/t/not-able-to-get-usid-using-getenv-confd-maapi-usid/1507 "2017-09-01T06:17:33Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![khan](https://avatars.discourse-cdn.com/v4/letter/k/3ab097/32.png) [@khan](https://dmap-community.ductus.global/u/khan)\
**Post date:** [September 1, 2017, 6:17am UTC](https://dmap-community.ductus.global/t/not-able-to-get-usid-using-getenv-confd-maapi-usid/1507/1 "2017-09-01T06:17:33Z")

</div>

Hi,  
i want to write one application which will read some configuration commands from file and execute them.  
from user guide i figured out that we can use. maapi\_load\_config() api for this, in order to use this i need to perform below steps from my application.

1. maapi\_connect()
2. maapi\_authenticate2 because im using external authentication.
3. maaapi\_start\_user\_session. with context as cli/system/non-system.

but the problem here is even though maapi\_start\_Seession() is returning confd\_ok im getting a NULL value for getenv(“CONFD\_MAAPI\_USID”) and getenv(“CONFD\_MAAPI\_THANDLE”)  
i need thandle for maapi\_load\_config() api.

please suggest im missing out something here.

thanks

---

<div class="post-metadata">

**Author:** ![mnovak](https://yyz2.discourse-cdn.com/flex010/user_avatar/dmap-community.ductus.global/mnovak/32/183_2.png) [@mnovak](https://dmap-community.ductus.global/u/mnovak)\
**Post date:** [September 1, 2017, 7:52am UTC](https://dmap-community.ductus.global/t/not-able-to-get-usid-using-getenv-confd-maapi-usid/1507/2 "2017-09-01T07:52:01Z")

</div>

Hello, to get user session id you can use `int maapi_get_my_user_session_id(int sock)`, to get transaction handle, you first need to start transaction with `maapi_start_trans`.  
BTW: `maapi_load_config` does not need user session id, only transaction handle.
