@app.route("<STR_LIT>", methods=["<STR_LIT:POST>"])<EOL>def connect(node_id, other_node_id):
exp = Experiment(session)<EOL>direction = request_parameter(parameter="<STR_LIT>", default="<STR_LIT:to>")<EOL>if type(direction == Response):<EOL><INDENT>return direction<EOL><DEDENT>node = models.Node.query.get(node_id)<EOL>if node is None:<EOL><INDENT>return error_response(error_type="<STR_LIT>")<EOL><DEDENT>other_node = models.Node.query.get(other_node_id)<EOL>if other_node is None:<EOL><INDENT>return error_response(<EOL>error_type="<STR_LIT>",<EOL>participant=node.participant,<EOL>)<EOL><DEDENT>try:<EOL><INDENT>vectors = node.connect(whom=other_node, direction=direction)<EOL>for v in vectors:<EOL><INDENT>assign_properties(v)<EOL><DEDENT>exp.vector_post_request(node=node, vectors=vectors)<EOL>session.commit()<EOL><DEDENT>except Exception:<EOL><INDENT>return error_response(<EOL>error_type="<STR_LIT>",<EOL>status=<NUM_LIT>,<EOL>participant=node.participant,<EOL>)<EOL><DEDENT>return success_response(vectors=[v.__json__() for v in vectors])<EOL>
Connect to another node.

    The ids of both nodes must be speficied in the url.
    You can also pass direction (to/from/both) as an argument.