Hi,

   We are trying to upload a diff to a draft review request using http api 
request ,however we are unable to upload the diff file.
Actually we don't know the correct url to upload the diff file and also 
need to know which all data fields are required for uploading the diff file.
Following is the code  we are using and the error message:
We tried with both put and post method:
****************
import requests
import json
from requests.auth import HTTPBasicAuth

username="username"
password="password"
API_ENDPOINT_2 ="https://reviewserver/api/review-requests/135/draft/diffs/";
payload = {"basedir":"/","path":"C:\\review\\diff1.diff"} 
r2 = requests.post(url= API_ENDPOINT_2,auth=HTTPBasicAuth(username, 
password),form-data,name="C:\\review\\",filename="diff1.diff")
print(r2.text)
****************
Error message while using put:

<!DOCTYPE html>

<html>
 <head>
  <title>500 - Internal Server Error | Review Board</title>
 </head>
 <body>
  <h1>Something broke! (Error 500)</h1>
  <p>
   It appears something broke when you tried to go to here. This is either
   a bug in Review Board or a server configuration error. Please report
   this to your administrator.
  </p>
 </body>
</title>

*******************************
Error message while using post:
{"fields": {"path": ["This field is required"]}, "stat": "fail", "err": 
{"msg": "One or more fields had errors", "code": 105}}

********************************
Following are the info of the created review request:

{"stat": "ok", "draft": {"commit_id": null, "extra_data": {}, 
"last_updated": "2019-02-22T08:13:23Z", "description": "description06", 
"target_people": [], "changedescription": "", "depends_on": [], 
"description_text_type": "plain", "target_groups": [], 
"testing_done_text_type": "plain", "links": {"self": {"href": 
"https://reviewserver.com/api/review-requests/135/draft/";, "method": 
"GET"}, "draft_diffs": {"href": 
"https://reviewserver.com/api/review-requests/135/draft/diffs/";, "method": 
"GET"}, "update": {"href": 
"https://reviewserver.com/api/review-requests/135/draft/";, "method": 
"PUT"}, "draft_screenshots": {"href": 
"https://reviewserver.com/api/review-requests/135/draft/screenshots/";, 
"method": "GET"}, "draft_file_attachments": {"href": 
"https://reviewserver.com/api/review-requests/135/draft/file-attachments/";, 
"method": "GET"}, "submitter": {"href": 
"https://reviewserver.com/api/users/Sbiroot/";, "method": "GET", "title": 
"Sbiroot"}, "review_request": {"href": 
"https://reviewserver.com/api/review-requests/135/";, "method": "GET", 
"title": "summary06"}, "delete": {"href": 
"https://reviewserver.com/api/review-requests/135/draft/";, "method": 
"DELETE"}}, "summary": "summary06", "testing_done": "", "branch": "", 
"text_type": null, "id": 132, "bugs_closed": [], 
"changedescription_text_type": "plain", "public": false}}

-- 
Supercharge your Review Board with Power Pack: 
https://www.reviewboard.org/powerpack/
Want us to host Review Board for you? Check out RBCommons: 
https://rbcommons.com/
Happy user? Let us know! https://www.reviewboard.org/users/
--- 
You received this message because you are subscribed to the Google Groups 
"Review Board Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to