Forum Discussion

radhika_kundana's avatar
3 years ago
Solved

Join node/group 301 API error

Hi,

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 we see actual error details to find 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://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: 

 POST https://lithium.com/api/2.0/nodes/grouphub:MexicoPowerApps/membership_requests   500

{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

4 Replies

  • Hi Folks,

    I am using the mutation below to join a node in Postman, but it is returning an error. Could you please suggest where I might be going wrong? Any help would be greatly appreciated.

    mutation JoinNode($nodeId: ID!) {
        joinNode(nodeId: $nodeId) {
          result
          errors {
          ... on Error {
            message
          }
          ... on MembershipNodeNotFound {
            message
            fields
          }
          ... on MembershipActionNotAllowed {
            message
            fields
          }
          ... on MembershipUserNotFound {
            message
            fields
          }
          ... on NotAMembershipNode {
            message
            fields
          }
        }
        }
      }
    
    Variable Passed
    
    {
        "nodeId": "grouphub:test-open-gh"
    }
    
    Response:
    
    {
        "errors": [
            {
                "message": "Exception while fetching data (/joinNode) : lithium.api.exceptions.RestApiWrappedException: objRef",
                "locations": [
                    {
                        "line": 2,
                        "column": 3
                    }
                ],
                "path": [
                    "joinNode"
                ],
                "extensions": {
                    "classification": "DataFetchingException"
                }
            }
        ],
        "data": null



    Thanks in advance!

  • Hello yogeshdixit,

    You are missing "node:" in variable section. Just update your variable with the following:

    {
    "nodeId": "node:grouphub:test-open-gh"
    }