def METHOD_NAME(user_id, research_index):
    try:
        req = request.json
    except:
        req = None
    if req is None or not req:
        # get ro crate file from portIn
        crates = []
        researchObj = Research(userId=user_id, researchIndex=research_index)
        for port in researchObj.portIn:
            filepath = ""
            for prop in port["properties"]:
                if prop["portType"] == "customProperties":
                    for cProp in prop["value"]:
                        if cProp["key"] == "filepath":
                            if str(cProp["value"]).endswith("/"):
                                filepath = "{}{}".format(
                                    cProp["value"], "ro-crate-metadata.json"
                                )
                            else:
                                filepath = "{}{}".format(
                                    cProp["value"], "/ro-crate-metadata.json"
                                )
            data = Util.parseToken(Util.loadToken(user_id, port["port"]))
            data["filepath"] = filepath
            crates.append(
                json.loads(
                    BytesIO(
                        requests.get(
                            "http://layer1-{}/storage/file".format(
                                port["port"]),
                            json=data,
                            verify=(os.environ.get(
                                "VERIFY_SSL", "True") == "True"),
                        ).content
                    )
                    .read()
                    .decode("UTF-8")
                )
            )
        # push ro crate content to all portOut metadata
        for crate in crates:
            for port in researchObj.portOut:
                projectId = ""
                for prop in port["properties"]:
                    if prop["portType"] == "customProperties":
                        for cProp in prop["value"]:
                            if cProp["key"] == "projectId":
                                projectId = cProp["value"]
                data = Util.parseToken(Util.loadToken(user_id, port["port"]))
                data["metadata"] = crate
                requests.METHOD_NAME(
                    "http://layer1-{}/metadata/project/{}".format(
                        port["port"], projectId
                    ),
                    json=data,
                    verify=(os.environ.get("VERIFY_SSL", "True") == "True"),
                )
        return "", 202
    mdService = Metadata(testing=current_app.config.get("TESTING"))
    research_id = mdService.getResearchId(user_id, research_index)
    result = mdService.updateMetadataForResearch(research_id, req)
    return jsonify({"length": len(result), "list": result})