Xtina
02/29/2024, 6:38 PMconst getCurrentAccountHeader = {
"Content-Type": 'application/json',
"Authorization": 'Bearer ' + accessToken,
"Dropbox-API-Select-Admin": ADMIN_USER
};
var getCurrentAccountResponse = https.request({
method: <http://https.Method.POST|https.Method.POST>,
url:"<https://api.dropboxapi.com/2/users/get_current_account>",
headers: getCurrentAccountHeader,
body: "null"
});
I know for a fact my accessToken is correct. I successfully got member info.
I’ve tried all variations in the body: null, “null”, {}, ‘{}’, JSON.stringify(null), JSON.stringify(‘null’)
I tried removing the “Content-Type” and NetSuite gives me an unexpected error if I do that.
Anyone have any experience with this? Ready to pull my hair out...Eric B
02/29/2024, 7:20 PMEric B
02/29/2024, 7:20 PMXtina
02/29/2024, 7:27 PMbody: "Error in call to API function "users/get_current_account": request body: expected null, got value"
battk
02/29/2024, 10:05 PMXtina
02/29/2024, 10:08 PMvar getCurrentAccountResponse = https.request({
method: https.Method.POST,
url:"<https://api.dropboxapi.com/2/users/get_current_account>",
headers: getCurrentAccountHeader,
body: JSON.stringify({})
});
battk
02/29/2024, 10:08 PMXtina
02/29/2024, 10:53 PMbattk
02/29/2024, 11:28 PMbattk
02/29/2024, 11:28 PMbattk
02/29/2024, 11:28 PMXtina
03/01/2024, 7:50 AMconst body = null;
const getCurrentAccountHeader = {
"Content-Type": 'application/json',
"Accept": 'application/json',
"Authorization": 'Bearer ' + accessToken,
"Dropbox-API-Select-Admin": ADMIN_USER
};
var getCurrentAccountResponse = https.request({
method: <http://https.Method.POST|https.Method.POST>,
url: "<https://api.dropboxapi.com/2/users/get_current_account>",
headers: getCurrentAccountHeader,
body: body
});
body outputs as
But then I get "Error in call to API function "users/get_current_account": request body: could not decode input as JSON"
Ok it needs JSON so I try this
const body = JSON.stringify(null);
const getCurrentAccountHeader = {
"Content-Type": 'application/json',
"Accept": 'application/json',
"Authorization": 'Bearer ' + accessToken,
"Dropbox-API-Select-Admin": ADMIN_USER
};
var getCurrentAccountResponse = https.request({
method: <http://https.Method.POST|https.Method.POST>,
url: "<https://api.dropboxapi.com/2/users/get_current_account>",
headers: getCurrentAccountHeader,
body: body
});
Body is null
"Error in call to API function "users/get_current_account": request body: could not decode input as JSON"
battk
03/01/2024, 9:10 AMbattk
03/01/2024, 9:10 AMbattk
03/01/2024, 9:11 AMbattk
03/01/2024, 9:13 AMXtina
03/01/2024, 9:33 AMconst getCurrentAccountHeader = {
"Authorization": 'Bearer ' + accessToken,
"Dropbox-API-Select-Admin": ADMIN_USER
};
var getCurrentAccountResponse = https.request({
method: <http://https.Method.POST|https.Method.POST>,
url: "<https://api.dropboxapi.com/2/users/get_current_account>",
headers: getCurrentAccountHeader
});
I saw forums mention to not include the the content type and I tried that too. I get:
"Error in call to API function "users/get_current_account": Bad HTTP "Content-Type" header: "application/x-www-form-urlencoded; charset=UTF-8". Expecting one of "application/json", "application/json; charset=utf-8", "text/plain; charset=dropbox-cors-hack"
There was even suggestions to force the content type to be blank
const getCurrentAccountHeader = {
"Content-Type": "",
"Authorization": 'Bearer ' + accessToken,
"Dropbox-API-Select-Admin": ADMIN_USER
};
var getCurrentAccountResponse = https.request({
method: <http://https.Method.POST|https.Method.POST>,
url: "<https://api.dropboxapi.com/2/users/get_current_account>",
headers: getCurrentAccountHeader,
});
That results in an netsuite unexpected error
type: "internal error",
code: "UNEXPECTED_ERROR",
details: "An unexpected SuiteScript error has occurred",
Xtina
03/01/2024, 9:55 AM"Error in call to API function "users/get_current_account": request body: could not decode input as JSON"
"Content-Type": 'text/plain; charset=dropbox-cors-hack'
Results in a Netsuite unexpected error
type: "internal error",
code: "UNEXPECTED_ERROR",
details: "An unexpected SuiteScript error has occurred",
battk
03/01/2024, 9:56 AMbattk
03/01/2024, 9:59 AMbattk
03/01/2024, 10:03 AMbattk
03/01/2024, 10:03 AMbattk
03/01/2024, 10:04 AMbattk
03/01/2024, 10:04 AMbattk
03/01/2024, 10:05 AMbattk
03/01/2024, 10:07 AMXtina
03/01/2024, 8:32 PM