How I can get authentication token or do loging in Elastic Search using REST API? For example from POSTMAN - rest

I'm trying to list data from Elastic Search using the REST API on Postman.
But I get a security_exception error
I read the elastic documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-get-token.html
but didn't work.
I'm using Elastic 7.2
Method: POST
Content-type: Application/json
URI: http://xxx.xxx.xxx.xxx:9200/_security/oauth2/token
BODY:
{
"grant_type" : "password",
"username" : "user_name",
"password" : "correct_password"
}
I need this service to return the authentication token. But this is the response:
{
"error": {
"root_cause": [
{
"type": "security_exception",
"reason": "missing authentication credentials for REST request [/_security/oauth2/token]",
"header": {
"WWW-Authenticate": "Basic realm=\"security\" charset=\"UTF-8\""
}
}
],
"type": "security_exception",
"reason": "missing authentication credentials for REST request [/_security/oauth2/token]",
"header": {
"WWW-Authenticate": "Basic realm=\"security\" charset=\"UTF-8\""
}
},
"status": 401
}

Try to do a basic authentication instead. And pass in the body just the grant_type.

Related

I keep getting error 404 when creating a new document archive

I am testing the Clio API through Postman but I keep getting error 404 when I tried creating a new document. Below is the sample request.
POST https://app.clio.com/api/v4/document_archives.json?fields=id,size,progress,state
Content-Type: application/json
Authorization: Bearer ****
Body
{
"data": {
"items": [
{
"id": 5998571944,
"type": "Folder"
}
]
}
}

Getting access forbidden when calling a SendGrid API

Trying to invoke https://api.sendgrid.com/v3/suppression/bounces (https://docs.sendgrid.com/api-reference/bounces-api/retrieve-all-bounces) and I get a message of "access forbidden".
I am passing in a valid API Key, which is from a free new account.
API:
GET
Headers:
Authorization Bearer SG.xxxxxxxxxxxxxxxx
Accept application/json
Response:
{
"errors": [
{
"field": null,
"message": "access forbidden"
}
]
}

How do I use Marketo REST API with Postman?

I'm having a hard time trying to figure out how to properly use the Marketo REST API using Postman for testing purpose.
So far I can Authenticate and get my access_token,
but when I try to create a folder... (properly authenticated)
endpoint: [POST] /rest/asset/v1/folders.json
body:
{
"description": "Test Folder",
"name": "Test",
"parent": {
"id": 1,
"type": "Folder"
}
}
I get:
{
"success": false,
"errors": [
{
"message": "name cannot be null.",
"code": "701"
},
{
"message": "parent cannot be null",
"code": "701"
}
],
"requestId": "408a#1720c00a893",
"warnings": []
}
I don't know what I'm doing wrong.
See an example in the Marketo API documentation
Create/Update folder request should be an application/x-www-form-urlencoded not application/json
So in Postman, you have to post a form with three parameters:
parent={"id":416,"type":"Folder"}
name=Test 10 - deverly
description=This is a test
For the parent parameter you should specify a specific json-like text, which is a usual format for folderId
For generic folders (not programs) you can provide just integer id, without JSON structure, this is not recommended but can be used for manual API tests

How can I update a Keycloak password from the REST API (PUT method)?

I set up a keycloak server with LDAP users to take advantage of the SSO on my applications.
I would like to change the password of the logged in user on my application through the Keycloak API. So, in the future, my Angular application will be able to make a request to the keycloak API to change the password of the logged-in user.
So I tried to do what is indicated in the documentation (method PUT, reset-password) but without success ...
I did my tests with postman, I wonder if my token is the one to be used? Does the problem come from elsewhere?
I have this url :
PUT {url}/auth/admin/realms/{realm}/users/{id user}/reset-password/
I have this header :
Content-type application/json
i have this body :
{
"pass" : {
"type": "password",
"temporary": false,
"value": "my-new-password"
}
}
I get a 401 error if I did not try to renew the token quickly (which makes me say that the problem may not come from the token) and I get a 403 or 400 error when I got a new token via postman oAuth 2.0
I sometimes get this message:
Unrecognized field "pass" (class org.keycloak.representations.idm.CredentialRepresentation), not marked as ignorable
Please, help me !
You can see here my autorization in postman, i don't know what is "State"
Body of PUT Should be CredentialRepresentation, which is
{
"type":"password",
"value":"my-new-password",
"temporary":false
}
You can use POST method with these parametes:
URL:
http://[Server Address]/auth/admin/realms/[Realm Name]/users
Headers:
Content-Type application/json
Body:
{
"username": "test",
"firstName": "test",
"lastName": "test",
"email": "test#gmail.com",
"enabled": true,
"credentials": [{
"type": "password",
"value": "123456",
"temporary": false
}]
}
Change pass to credentials.
it’s better to check current password to increase the security

Google cloud storage client api not working for patch

I tried updating header of an object by using API explorer (as well as client library) by giving metadata object as header keys and values.
I only received error respond
{
error": {
"errors": [
{
"domain": "global",
"reason": "invalid",
"message": "Invalid argument."
}
],
"code": 400,
"message": "Invalid argument."
}
}
The request is:
PATCH https://www.googleapis.com/storage/v1beta2/b/mbi-figure/o/infovilla_paypal.png?key={YOUR_API_KEY}
Content-Type: application/json
Authorization: Bearer ya29
X-JavaScript-User-Agent: Google APIs Explorer
{
"metadata": {
"title": "Kyaw"
}
}
You've run into a bug with PATCH that is being worked on. Fortunately, there's a workaround. Adding a "projection=full" parameter to the URL should fix your problem.