API error for differential.creatediff after a server version update

Hi,

We use Phabicator since a long time and we have updated Phabicator in the server side.

We also used a custom tool to create new diff.
This tool uses the API /differential.creatediff and everything was fine before the server version update.

But now, the API returns an error {"result":null,"error_code":"ERR-CONDUIT-CORE","error_info":"Undefined index: metadata"}.

I suspect that the API behaviour has been changed in the new version.
I’ve studied the API documentation (https://secure.phabricator.com/conduit/method/differential.creatediff/) but it’s quite difficult to understand what is expected in the new version (an example of a call would be awsome to understand).

So, is there someone that could help me and tell me what is going wrong in my API call please ?
Because the following HTTP request works like a charm before the update.

If you have some example that works to give to me, it would be enough for me to adapt the source code in my custom tool.

Thanks in advance.

HTTP request (in one line “normaly”):

api.token=< api_token >&
sourceMachine=8929892&
sourcePath=C%3a%5cnet%5cdemo_branch&
bookmark=&
sourceControlSystem=svn&
sourceControlPath=https%3a%2f%2fsvn.mysvn.com%2fsvn%2fnet&
sourceControlBaseRevision=https%3a%2f%2fsvn.mysvn.com%2fsvn%2fnet%6576567&
creationMethod=ivConduit&
lintStatus=none&
unitStatus=none&
repositoryPHID=PHID-REPO-r2x87897dzgygzdyjaxs&
changes[svn%2fbranches%2fsvn%2fROOT%2fuser%2futil.ascx.cs][oldPath]=svn%2fbranches%svn%2fROOT%2fuser%2futil.ascx.cs&
changes[svn%2fbranches%2fsvn%2fROOT%2fuser%2futil.ascx.cs][currentPath]=svn%2fbranches%svn%2fROOT%2fuser%2futil.ascx.cs&
changes[svn%2fbranches%2fsvn%2fROOT%2fuser%2futil.ascx.cs][type]=2&
changes[svn%2fbranches%2fsvn%2fROOT%2fuser%2futil.ascx.cs][fileType]=1&
changes[svn%2fbranches%2fsvn%2fROOT%2fuser%2futil.ascx.cs][hunks][0][oldOffset]=1&
changes[svn%2fbranches%2fsvn%2fROOT%2fuser%2futil.ascx.cs][hunks][0][newOffset]=1&
changes[svn%2fbranches%2fsvn%2fROOT%2fuser%2futil.ascx.cs][hunks][0][oldLength]=3584&
changes[svn%2fbranches%2fsvn%2fROOT%2fuser%2futil.ascx.cs][hunks][0][newLength]=3625&
changes[svn%2fbranches%2fsvn%2fROOT%2fuser%2futil.ascx.cs][hunks][0][addLines]=53&
changes[svn%2fbranches%2fsvn%2fROOT%2fuser%2futil.ascx.cs][hunks][0][delLines]=12&
changes[svn%2fbranches%2fsvn%2fROOT%2fuser%2futil.ascx.cs][hunks][0][isMissingOldNewline]=false&
changes[svn%2fbranches%2fsvn%2fROOT%2fuser%2futil.ascx.cs][hunks][0][isMissingNewNewline]=false&
changes[svn%2fbranches%2fsvn%2fROOT%2fuser%2futil.ascx.cs][hunks][0][corpus]=< patch_diff >

HTTP response:

{"result":null,"error_code":"ERR-CONDUIT-CORE","error_info":"Undefined index: metadata"}

Hi!
Maybe, somebody can just give me an example of a JSON stream to send for this REST API ?
Anything that can help me to modify my API call to restore the functionnality in my tool please. :frowning:
Thanks in advance.

Your best bet is probably to capture a request made by Arcanist - I believe what you’re missing is a metadata key inside the changes dict though.

I haven’t looked at what Arcanist is sending (best for you to dig through the code yourself for that), but when reading a diff back with differential.querydiffs I can see the following inside each item of changes:

"metadata": {
  "line:first": 6,
  "hash.effect": "05zrHViUe0ie"
},

Thanks for your answer asherkin!
I’m not an expert of Phabricator, can you tell me in few words what is Arcanist please ?

Arcanist is the client-side app for Phabricator; It’s what most users use to create diffs.

If you visit https://secure.phabricator.com/conduit/method/differential.creatediff/ (or the equivalent page on your install), you can use the form to make a call; On the results page, scroll to the buttom and click “cURL”, you’ll see an example call.

Ok thanks a lot!
I don’t see clearly what to fill for “changes” which is a list < dict >, does anyone have an example please ?