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: