Maniphest.edit adding ticket to column with position using "beforePHIDs"

According to the maniphest.edit “Transaction Type: Column” documentation, the beforePHIDs parameter should be an array of PHIDs. I think this would look like the following:

curl https://5555/api/maniphest.edit \
    -d api.token=api-token \
    -d transactions[0][type]=column \
    -d transactions[0][value][0][columnPHID]=PHID-PCOL-6666 \
    -d transactions[0][value][0][beforePHIDs][0]=PHID-TASK-7777 \
    -d objectIdentifier=PHID-TASK-8888

However, when invoked as such (with beforePHIDs as an array) I get the following error, which seems to contradict the documentation:

Exception when processing transaction of type “column”: Error while reading “value[0]”: Expected string, got something else.

How does my curl statement need to change for this to work? I’ve tried every permutation I can think of. Or is this perhaps a bug?

Side note - this works fine (once I’ve added the ticket to the project with maniphest.edit projects.add), but it doesn’t allow control for the ticket insertion point:

curl https://5555/api/maniphest.edit \
    -d api.token=api-token \
    -d transactions[0][type]=column \
    -d transactions[0][value][0]=PHID-PCOL-6666 \
    -d objectIdentifier=PHID-TASK-8888

Thanks for any tips! I suspect I’m doing something silly :stuck_out_tongue_winking_eye:

Side note 2: This is a copy of a question I posted to StackOverflow. I’ll update it there if anyone can point me in the right direction. Thanks!

You can use the Documentation page to make an actual query; In the results page, if you scroll to the bottom and click cURL, you’ll see an example of how to correctly make the same call using cURL.

Ya that’s how I did the queries I posted.

Context: my actual project is using Python to do the queries. I have around 10 other queries of various complexities which all work nicely. I usually use the docs page as you outlined for testing my queries before translating them to Python. This is the only one I haven’t cracked.

The value needs to be an associative array with named keys, not numerical keys. I’m going to express it as json because it’s much MUCH less confusing than the encoding used in the curl command above.

{
  transactions:  [
   {
     "type": "column",
     "value": {
       "columnPHID": "PHID-PCOL-6666",
       "beforePHIDs": ["PHID-TASK-7777"]
      }
   }
]

I think the mistake you are making in your curl call is adding [0] after value. There are not multiple values, there must be one value (object, not array) with multiple keys inside. The beforePHIDs key is an array but the value key is not an array.

So, like this should work:

curl https://5555/api/maniphest.edit \
    -d api.token=api-token \
    -d transactions[0][type]=column \
    -d transactions[0][value][columnPHID]=PHID-PCOL-6666 \
    -d transactions[0][value][beforePHIDs][0]=PHID-TASK-7777 \
    -d objectIdentifier=PHID-TASK-8888

btw, the code that is validating this transaction is here:

Hmm without the [0] after value I get:

“Exception when processing transaction of type “column”: Error while reading “value”: Expected a list, but value is an object.”

It seems to want an array :thinking:

Hey avivey would you know who else I could maybe ping about this? Still can’t get it to work and am starting to suspect there’s maybe a bug…

I’m afraid your only “better” option is via paid support at phacility.com.

I’ve never attempted a query this complex using the cURL form, partly because it’s very hard to read; whenever I’m trying to make a conduit call, I use the JSON form (either via arc-call-conduit or by mimicking the way arc makes the call).

It’s not impossible that there is a bug here, but setting up a test case is tedious.

The simple column setting variant works as expected:
echo '{"transactions": [{"type": "column", "value":["PHID-PCOL-ddzekwiudckze3hpxsfq"]}],"objectIdentifier":"T1"}' | /phab/arcanist/bin/arc call-conduit maniphest.edit --

Following the upstream docs, it fails:
echo '{"transactions": [{"type": "column", "value":[{"columnPHID":"PHID-PCOL-ddzekwiudckze3hpxsfq"}]}],"objectIdentifier":"T1"}' | /phab/arcanist/bin/arc call-conduit maniphest.edit --
says
Exception when processing transaction of type \"column\": Error while reading \"value[0]\": Expected string, got something else.

Making the columnPHID value an array, just as a strange try, also fails:
echo '{"transactions": [{"type": "column", "value":[{"columnPHID":["PHID-PCOL-ddzekwiudckze3hpxsfq"]}]}],"objectIdentifier":"T1"}' | /phab/arcanist/bin/arc call-conduit maniphest.edit --
says
Exception when processing transaction of type \"column\": Error while reading \"value[0]\": Expected string, got something else.

Trying to combine beforePHIDs with the simple column setting variant also fails:
echo '{"transactions": [{"type": "column", "value":["PHID-PCOL-ddzekwiudckze3hpxsfq"]}, {"type": "column", "value":[{"beforePHIDs":["PHID-TASK-clqaezr5z3kbragafqrt"]}]}],"objectIdentifier":"T1"}' | /phab/arcanist/bin/arc call-conduit maniphest.edit --
says
Exception when processing transaction of type \"column\": Error while reading \"value[0]\": Expected string, got something else."

Looks like Conduit is unable to parse values for column which are not a columnPHID but another key-value pair.

So either upstream documentation is wrong or upstream code is broken, I’d say.

1 Like

Agreed, the docs seem broken and probably the code is broken as well but it’s hard to tell what is the expected behavior. I wasn’t able to devine exactly what the code is expecting but it doesn’t seem to match the documentation at https://secure.phabricator.com/conduit/method/maniphest.edit/ (in the “Transaction Type: column” section)