curl -X POST "https://api-sbx.pre.globalgetnet.com/dpy/payment-link/v1/authentication/oauth2/-core/access_token" \
-H "Content-Type: application/x-www-form-urlencoded" \
-d '{
"grant_type": "client_credentials",
"client_id": "seu-client-id",
"client_secret": "seu-client-secret",
"scope": "digital-plataform:gateway-api"
}' const response = await fetch ( `https://api-sbx.pre.globalgetnet.com/dpy/payment-link/v1/authentication/oauth2/-core/access_token` , {
method: 'POST' ,
headers: { 'Content-Type' : 'application/x-www-form-urlencoded' },
body: JSON . stringify ({
"grant_type" : "client_credentials" ,
"client_id" : "seu-client-id" ,
"client_secret" : "seu-client-secret" ,
"scope" : "digital-plataform:gateway-api"
})
});
const data = await response. json (); import requests
response = requests.request(
"POST" ,
"https://api-sbx.pre.globalgetnet.com/dpy/payment-link/v1/authentication/oauth2/-core/access_token" ,
json = {
"grant_type" : "client_credentials" ,
"client_id" : "seu-client-id" ,
"client_secret" : "seu-client-secret" ,
"scope" : "digital-plataform:gateway-api"
},
)
data = response.json() <? php
$ch = curl_init ();
curl_setopt ($ch, CURLOPT_URL , "https://api-sbx.pre.globalgetnet.com/dpy/payment-link/v1/authentication/oauth2/-core/access_token" );
curl_setopt ($ch, CURLOPT_RETURNTRANSFER , true );
curl_setopt ($ch, CURLOPT_CUSTOMREQUEST , "POST" );
curl_setopt ($ch, CURLOPT_HTTPHEADER , [ "Content-Type: application/x-www-form-urlencoded" ]);
curl_setopt ($ch, CURLOPT_POSTFIELDS , '{
"grant_type": "client_credentials",
"client_id": "seu-client-id",
"client_secret": "seu-client-secret",
"scope": "digital-plataform:gateway-api"
}' );
$response = curl_exec ($ch);
curl_close ($ch); package main
import (
" fmt "
" io "
" net/http "
" strings "
)
func main () {
req, _ := http. NewRequest ( "POST" , "https://api-sbx.pre.globalgetnet.com/dpy/payment-link/v1/authentication/oauth2/-core/access_token" , strings. NewReader ( `{
"grant_type": "client_credentials",
"client_id": "seu-client-id",
"client_secret": "seu-client-secret",
"scope": "digital-plataform:gateway-api"
}` ))
req.Header. Set ( "Content-Type" , "application/x-www-form-urlencoded" )
resp, err := http.DefaultClient. Do (req)
if err != nil {
panic (err)
}
defer resp.Body. Close ()
data, _ := io. ReadAll (resp.Body)
fmt. Println ( string (data))
} HttpClient client = HttpClient. newHttpClient ();
HttpRequest request = HttpRequest. newBuilder ()
. uri (URI. create ( "https://api-sbx.pre.globalgetnet.com/dpy/payment-link/v1/authentication/oauth2/-core/access_token" ))
. header ( "Content-Type" , "application/x-www-form-urlencoded" )
. method ( "POST" , HttpRequest.BodyPublishers. ofString ( "{ \n \" grant_type \" : \" client_credentials \" , \n \" client_id \" : \" seu-client-id \" , \n \" client_secret \" : \" seu-client-secret \" , \n \" scope \" : \" digital-plataform:gateway-api \"\n }" ))
. build ();
HttpResponse< String > response = client. send (request, HttpResponse.BodyHandlers. ofString ());
System.out. println (response. body ()); require "net/http"
require "uri"
uri = URI ( "https://api-sbx.pre.globalgetnet.com/dpy/payment-link/v1/authentication/oauth2/-core/access_token" )
http = Net :: HTTP . new (uri. host , uri. port )
http. use_ssl = uri. scheme == "https"
request = Net :: HTTP :: Post . new (uri)
request[ "Content-Type" ] = "application/x-www-form-urlencoded"
request. body = "{ \n \" grant_type \" : \" client_credentials \" , \n \" client_id \" : \" seu-client-id \" , \n \" client_secret \" : \" seu-client-secret \" , \n \" scope \" : \" digital-plataform:gateway-api \"\n }"
response = http. request (request)
puts response. body ⧉