Forum Discussion
Hi ChhamaJ,
I was able to implement Leave node successfully using membership API(Javascript).
But Join node API is returning 301 error and I don't see error details, can you guide me on the issue.
Code: I am calling below function on button click.
function joinNode()
{
const options = {
method: 'POST',
headers: {Accept: 'application/json', 'Content-Type': 'application/json'}
};
console.log(options);
fetch('https://frnmb74945.stage.lithium.com/api/2.0/nodes/grouphub:'+ groupID + '/membership_requests', options)
.then(response => response.json())
.then(response => console.log(response))
.catch(err => console.error(err));
}
Error details from console:
{status: 'error', message: 'An unexpected error occurred.', data: {…}, metadata: {…}} data:code: 301
developer_message: ""
more_info: ""
type: "error_data"
[[Prototype]]: Object
message: "An unexpected error occurred."
metadata: {}
status: "error"
[[Prototype]]: Object
Hi radhika_kundana you forgot the body
{
"data" : {
"type" : "membership_request"
}
}
This call worked for me
curl --location --request POST 'https://frnmb74945.stage.lithium.com/api/2.0/nodes/grouphub:region-east/membership_requests?restapi.session_key=9Lu7OU_KvuuPOMw9FqHaOZ33KVBAJnkpTKcQxVNufHQ.' \
--header 'Authorization: Basic aGNsZGV2OlN6YWJyTmRwaw==' \
--header 'Content-Type: application/json' \
--data-raw '{
"data" : {
"type" : "membership_request"
}
}'
Related Content
- 5 years ago
- 3 years ago