NocoDB
API Headers [May 08]
Discord-Discussions
NocoDB
November 3, 2022, 9:33am
1
Ditmas
asked
let headersList = {
“xc-auth”: “9bYhm5IA6taqBxFyey-K8nRrJeXMZ49JWonriVnu”,
“xc-token”: “9bYhm5IA6taqBxFyey-K8nRrJeXMZ49JWonriVnu”,
“Content-Type”: “application/json; charset=utf-8”,
Accept: “application/json”,
};
let bodyContent = JSON.stringify({
naam: “stef”,
achternaam: “hermans”,
});
let reqOptions = {
url: “
http://groepswerkana.herokuapp.com/api/v1/db/data/noco/groepswerkana/test
”,
method: “POST”,
headers: headersList,
body: bodyContent,
};
useEffect(() => {
(async () => {
const { data } = await axios.request(reqOptions);
console.log(data);
})();
},
);
NocoDB
November 3, 2022, 9:33am
2
o1lab
replied
Use one header : xc-auth or xc-token
NocoDB
November 3, 2022, 9:33am
3
Ditmas
replied
yes that’s something i still need to change, but the requests comes through… it’s just that my fields are empty
NocoDB
November 3, 2022, 9:33am
4
Ditmas
replied
so there is something wrong with my JSON? but when i do the exact same request through thunderbold on vscode it works
NocoDB
November 3, 2022, 9:33am
5
Ditmas
replied
it’s really weird
NocoDB
November 3, 2022, 9:33am
6
o1lab
replied
NocoDB
November 3, 2022, 9:33am
7
o1lab
replied
please review your code once more
NocoDB
November 3, 2022, 9:33am
8
o1lab
replied
I see JSON.stringidy ? you are supposed to send an object
NocoDB
November 3, 2022, 9:33am
9
Ditmas
replied
really? thats very weird because my thunderbolt does the same and that works fine…
NocoDB
November 3, 2022, 9:33am
10
Ditmas
replied
what should there be in place of stringify perhaps?
NocoDB
November 3, 2022, 9:33am
11
Ditmas
replied
thunder client*
NocoDB
November 3, 2022, 9:33am
12
o1lab
replied
sorry, you will have to lookup axios request. Im not at desk.
NocoDB
November 3, 2022, 9:33am
13
Ditmas
replied
it just accepts one parameter which is the configuration you give with it
NocoDB
November 3, 2022, 9:33am
14
Ditmas
replied
url, header, body
NocoDB
November 3, 2022, 9:33am
15
Ditmas
replied
method
NocoDB
November 3, 2022, 9:33am
16
Ditmas
replied
it works fine like that i think there is just something miss with my json.object
NocoDB
November 3, 2022, 9:33am
17
Ditmas
replied
while again this works fine in a postman or thunder client… just like i send… it’s kind of weird
NocoDB
November 3, 2022, 9:33am
18
Ditmas
replied
problem is solved, it seems like nocoDB/Swagger doesnt support axios very well
NocoDB
November 3, 2022, 9:33am
19
Ditmas
replied
u need to use fetch
NocoDB
November 3, 2022, 9:33am
20
Ditmas
replied
old school fetch
next page →
Related topics
Topic
Replies
Views
Activity
Heroku API [Apr 03]
Discord-Discussions
10
270
November 3, 2022
Code snippets [Sep 17]
Discord-Discussions
20
376
November 3, 2022
Xc-token API key auth issue on create link request
APIs
1
164
April 3, 2024
CORS issue after upgrading [Dec 29]
Discord-Discussions
22
360
November 3, 2022
Unable to create table via APIs [Jun 07]
Discord-Discussions
23
503
November 3, 2022