# Missing Authentication Credentials for REST Request

**URL:** <https://discuss.elastic.co/t/missing-authentication-credentials-for-rest-request/271158>\
**Category:** Elasticsearch\
**Created:** [April 24, 2021, 6:19pm UTC](https://discuss.elastic.co/t/missing-authentication-credentials-for-rest-request/271158 "2021-04-24T18:19:41Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![hussshe](https://avatars.discourse-cdn.com/v4/letter/h/7cd45c/32.png) [@hussshe](https://discuss.elastic.co/u/hussshe)\
**Post date:** [April 24, 2021, 6:19pm UTC](https://discuss.elastic.co/t/missing-authentication-credentials-for-rest-request/271158/1 "2021-04-24T18:19:41Z")

</div>

Hello Elastic Users,

I am trying to check if my Elasticsearch is working fine or not by running the following command in WindowsPowershell.

Invoke-RestMethod [http://localhost:9200](http://localhost:9200)

But it threw an 401-Authentication error. I am not sure how to pass on the credentials along with Invoke Command in Powershell.

\<  
PS C:\Users\hussshe\> Invoke-RestMethod [http://localhost:9200](http://localhost:9200)  
Invoke-RestMethod : {"error":{"root\_cause":[{"type":"security\_exception","reason":"missing authentication credentials  
for REST request [/]","header":{"WWW-Authenticate":"Basic realm="security"  
charset="UTF-8""}}],"type":"security\_exception","reason":"missing authentication credentials for REST request  
[/]","header":{"WWW-Authenticate":"Basic realm="security" charset="UTF-8""}},"status":401}  
At line:1 char:1

- Invoke-RestMethod [http://localhost:9200](http://localhost:9200)
- 

```auto
  + CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebExc
 eption
  + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand

```

/\>

P.S: I am a beginner trying to learn ELK on my own.

Any help would be appreciated.

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [April 28, 2021, 1:40am UTC](https://discuss.elastic.co/t/missing-authentication-credentials-for-rest-request/271158/2 "2021-04-28T01:40:25Z")

</div>

I don't know powershell, but a quick web search shows me this doesn't look easy - [https://www.reddit.com/r/PowerShell/comments/gs7i4s/calling\_an\_api\_using\_invokerestmethod\_using/](https://www.reddit.com/r/PowerShell/comments/gs7i4s/calling_an_api_using_invokerestmethod_using/)

Unfortunately this is outside the scope of what we can assist with here sorry to say.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [May 26, 2021, 1:41am UTC](https://discuss.elastic.co/t/missing-authentication-credentials-for-rest-request/271158/3 "2021-05-26T01:41:09Z")

</div>

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