@@ -52,8 +52,8 @@ def get_lookup_list(request: Request, project_id: str, lookup_list_id: str):
52
52
return responses .JSONResponse (status_code = status .HTTP_200_OK , content = resp .json ())
53
53
54
54
55
- @app .post ("/project/{project_id}/import " )
56
- async def post_import (request : Request , project_id : str ):
55
+ @app .post ("/project/{project_id}/import_file " )
56
+ async def post_import_file (request : Request , project_id : str ):
57
57
try :
58
58
user_id = get_user_id_from_request (request )
59
59
except KeyError :
@@ -62,7 +62,7 @@ async def post_import(request: Request, project_id: str):
62
62
content = {"error_code" : ErrorCodes .UNRECOGNIZED_USER },
63
63
)
64
64
request_body = await request .json ()
65
- url = f"{ BASE_URI } /project/{ project_id } /import "
65
+ url = f"{ BASE_URI } /project/{ project_id } /import_file "
66
66
resp = requests .post (
67
67
url ,
68
68
json = {
@@ -75,6 +75,27 @@ async def post_import(request: Request, project_id: str):
75
75
return responses .JSONResponse (status_code = status .HTTP_200_OK , content = resp .json ())
76
76
77
77
78
+ @app .post ("/project/{project_id}/import_json" )
79
+ async def post_import_json (request : Request , project_id : str ):
80
+ try :
81
+ user_id = get_user_id_from_request (request )
82
+ except KeyError :
83
+ return responses .JSONResponse (
84
+ status_code = status .HTTP_401_UNAUTHORIZED ,
85
+ content = {"error_code" : ErrorCodes .UNRECOGNIZED_USER },
86
+ )
87
+ request_body = await request .json ()
88
+ url = f"{ BASE_URI } /project/{ project_id } /import_json"
89
+ resp = requests .post (
90
+ url ,
91
+ json = {
92
+ "user_id" : user_id ,
93
+ "records" : request_body ["records" ],
94
+ },
95
+ )
96
+ return responses .JSONResponse (status_code = status .HTTP_200_OK , content = resp .json ())
97
+
98
+
78
99
@app .post ("/project/{project_id}/associations" )
79
100
async def post_associations (request : Request , project_id : str ):
80
101
try :
0 commit comments