Correct Aphlict websocket URI construction after PHP8 compatibility changes
[phabricator.git] / src / docs / user / userguide / conduit_edit.diviner
blob5188300e6d934690ee0943cf4e8c40ca5df49763
1 @title Conduit API: Using Edit Endpoints
2 @group conduit
4 Describes how to use edit endpoints to create and update objects.
6 Overview
7 ========
9 Many applications provide `edit` endpoints, which are the primary way to
10 create and update objects (like tasks) using the API.
12 To create or edit an object, you'll build a list of //transactions// and pass
13 them to the endpoint. Each transaction applies a change to a field or property
14 on the object.
16 For example, a transaction might change the title of an object or add
17 subscribers.
19 When creating an object, transactions will be applied to an empty object. When
20 editing an object, transactions will be applied to an existing object.
22 The best reference for a particular `edit` endpoint is the Conduit API console.
23 For example, you can find the console page for `maniphest.edit` by navigating
24 to {nav Conduit > maniphest.edit} in the web UI. This page contains detailed
25 information about the endpoint and how it can be used.
27 Creating Objects
28 ================
30 To create objects, pass a list of transactions but leave `objectIdentfier`
31 blank. This tells the endpoint that you want to create a new, empty object and
32 then apply the transactions to it.
35 Editing Objects
36 ===============
38 To edit objects, pass a list of transactions and use `objectIdentifier` to
39 specify which object to apply them to. You can normally pass an ID or PHID,
40 and many applications also allow you to pass a monogram (for example, you can
41 edit a task by passing `T123`).
44 Building Transactions
45 =====================
47 When creating or editing objects, you'll build a list of transactions to
48 apply. This transaction list will look something like this:
50 ```lang=json, name="Example Transaction List"
52   {
53     "type": "title",
54     "value": "Assemble in the barnyard"
55   },
56   {
57     "type": "description",
58     "value": "All animals should assemble in the barnyard promptly."
59   },
60   {
61     "type": "subscribers.add",
62     "value": ["dog", "cat", "mouse"]
63   }
65 ```
67 Applied to an empty object (say, a task), these transactions would create a new
68 task with the specified title, description and subscribers.
70 Applied to an existing object, they would retitle the task, change its
71 description, and add new subscribers.
73 The particular transactions available on each object are documented on the
74 Conduit API console page for that object.
77 Return Type
78 ===========
80 WARNING: The structure of the return value from these methods is likely to
81 change as ApplicationEditor evolves.
83 Return values look something like this for now:
85 ```lang=json, name=Example Return Value
87   "object": {
88     "phid": "PHID-XXXX-1111"
89   },
90   "transactions": [
91     {
92       "phid": "PHID-YYYY-1111",
93     },
94     {
95       "phid": "PHID-YYYY-2222",
96     }
97   ]
99 ```
101 The `object` key contains information about the object which was created or
102 edited.
104 The `transactions` key contains information about the transactions which were
105 actually applied. For many reasons, the transactions which actually apply may
106 be greater or fewer in number than the transactions you provided, or may differ
107 in their nature in other ways.
110 Next Steps
111 ==========
113 Continue by:
115   - returning to the @{article:Conduit API Overview}.