Connect with 3rd party samba saftey

PHOTO EMBED

Mon Sep 23 2024 11:53:12 GMT+0000 (Coordinated Universal Time)

Saved by @usman13

url = "https://api-demo.sambasafety.io/oauth2/v1/token";
	headers = {
		"x-api-key": "WJDBWMdYFX3FbAlf3WY8DWBzaG3MaQI9SPbWE0j7",
		"Content-Type": "application/x-www-form-urlencoded",
		"Authorization": "Basic MG9hMTl5Yjlod2dyU3VnNVMzNTg6ZHBvNGFYLWZlWFBqQ2tHanF1YjgwdTc2OG5PY0pUQ3ZGSmtlOTVXUkc2RVFNbWdmMlQxWlUzOUthOEEtT0dnMA=="
	};
	params = map();
	params.put("grant_type", "client_credentials");
	params.put("scope", "API");
	x = invokeurl
	[
		url: url
		type: POST 
		parameters:params
		headers: headers
];
//info x;
access_token = x.get("access_token");
/////////////////////////////////////////////
/////////////////////////////////////////////////////////

url = "https://api-demo.sambasafety.io/organization/v1/groups/92790";
headers = {
    "x-api-key": "WJDBWMdYFX3FbAlf3WY8DWBzaG3MaQI9SPbWE0j7",
    "Content-Type": "application/x-www-form-urlencoded",
    "Authorization": "Bearer " + access_token 
};

x = invokeurl
[
    url: url
    type: get
    headers: headers
];

info x;
content_copyCOPY

need x-api-key, Authorization, from the admin portal then we can run the oauth api and get the access token and then get the required data.