Skip to content

Commit

Permalink
also redeploy kobo form after csv upload
Browse files Browse the repository at this point in the history
  • Loading branch information
tijsziere committed Sep 20, 2024
1 parent 28736f3 commit f37b104
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -706,6 +706,20 @@ async def prepare_kobo_validation(request: Request, programId: int, kobousername
if upload_response.status_code != 201:
raise HTTPException(status_code=upload_response.status_code, detail="Failed to upload file to Kobo")

# Redeploy the Kobo form
redeploy_url = f"https://kobo.ifrc.org/api/v2/assets/{request.headers['koboasset']}/deployment/"
redeploy_payload = {"active": True}

redeploy_response = requests.patch(
redeploy_url,
headers=headers,
json=redeploy_payload
)

if redeploy_response.status_code != 200:
raise HTTPException(status_code=redeploy_response.status_code, detail="Failed to redeploy Kobo form")


return {"message": "Validation data prepared and uploaded successfully", "kobo_response": upload_response.json()}


Expand Down

0 comments on commit f37b104

Please sign in to comment.