Skip to content

Commit c20a43a

Browse files
committed
Fix API payloads after local testing
1 parent f817a42 commit c20a43a

File tree

2 files changed

+55
-27
lines changed

2 files changed

+55
-27
lines changed

fern/docs/pages/custom-objects.mdx

Lines changed: 53 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -38,34 +38,31 @@ curl --location 'https://api.devrev.ai/schemas.custom.set' \
3838
"fields": [
3939
{
4040
"name": "name",
41-
"type": "string",
41+
"field_type": "tokens",
4242
"description": "Name of the campaign"
4343
},
4444
{
4545
"name": "start_date",
46-
"type": "date",
46+
"field_type": "date",
4747
"description": "Start date of the campaign"
4848
},
4949
{
5050
"name": "end_date",
51-
"type": "date",
51+
"field_type": "date",
5252
"description": "End date of the campaign"
5353
},
5454
{
5555
"name": "budget",
56-
"type": "number",
56+
"field_type": "int",
5757
"description": "Budget allocated for the campaign"
5858
},
5959
{
6060
"name": "target_audience",
61-
"type": "enum",
61+
"field_type": "enum",
6262
"description": "Target audience for the campaign",
6363
"allowed_values": [
64-
"young_adults",
65-
"seniors",
66-
"families",
67-
"professionals",
68-
"students"
64+
"Professionals",
65+
"Students"
6966
]
7067
}
7168
],
@@ -84,17 +81,46 @@ curl --location 'https://api.devrev.ai/custom-objects.create' \
8481
--data '{
8582
"leaf_type": "campaign",
8683
"custom_fields": {
87-
"name": "Summer Sale 2023",
88-
"start_date": "2023-06-01",
89-
"end_date": "2023-08-31",
90-
"budget": 10000,
91-
"target_audience": "Young adults"
84+
"tnt__name": "Summer Sale 2023",
85+
"tnt__start_date": "2023-06-01",
86+
"tnt__end_date": "2023-08-31",
87+
"tnt__budget": 10000,
88+
"tnt__target_audience": "Professionals"
9289
},
9390
"unique_key": "CAMP-001"
9491
}'
9592
```
9693

97-
The sections below provide more details on the available API endpoints for Custom Objects.
94+
The response of the above API call will be the ID of the custom object created.
95+
```
96+
{
97+
"custom_object": {
98+
"id": "don:core:dvrv-us-1:devo/11FVC3ScK:custom_object/campaign/1",
99+
"created_by": {...},
100+
"created_date": "2024-10-01T07:02:58.958Z",
101+
"modified_by": {...},
102+
"modified_date": "2024-10-01T07:02:58.958Z",
103+
"display_id": "C-CAMP-1",
104+
"leaf_type": "campaign",
105+
"unique_key": "CAMP-001"
106+
"stock_schema_fragment": "don:core:dvrv-us-1:stock_sf/1522526",
107+
"custom_schema_fragments": [
108+
"don:core:dvrv-us-1:devo/11FVC3ScK:tenant_fragment/261"
109+
],
110+
"custom_fields": {
111+
"tnt__budget": 10000,
112+
"tnt__end_date": "2023-08-31",
113+
"tnt__name": "Summer Sale 2023",
114+
"tnt__start_date": "2023-06-01",
115+
"tnt__target_audience": "Professionals"
116+
},
117+
}
118+
}
119+
```
120+
121+
Note that the `id` field in the above response is the system generated ID for the custom object.
122+
123+
The sections below provide more details on the available API endpoints for interacting with Custom Objects.
98124

99125
### Get a Custom Object
100126

@@ -106,8 +132,7 @@ curl --location 'https://api.devrev.ai/custom-objects.get' \
106132
--header 'Accept: application/json' \
107133
--header 'Authorization: <YOUR_API_TOKEN>' \
108134
--data '{
109-
"leaf_type": "campaign",
110-
"id": "<OBJECT_ID>"
135+
"id": "don:core:dvrv-us-1:devo/11FVC3ScK:custom_object/campaign/1"
111136
}'
112137
```
113138

@@ -122,9 +147,11 @@ curl --location 'https://api.devrev.ai/custom-objects.list' \
122147
--header 'Authorization: <YOUR_API_TOKEN>' \
123148
--data '{
124149
"leaf_type": "campaign",
125-
"filter": {
126-
"eq": ["custom_fields.target_audience", "Young adults"]
127-
}
150+
"filter": [
151+
"eq",
152+
"$custom_fields.ctype__target_audience",
153+
"Young adults"
154+
]
128155
}'
129156
```
130157

@@ -138,10 +165,9 @@ curl --location 'https://api.devrev.ai/custom-objects.update' \
138165
--header 'Accept: application/json' \
139166
--header 'Authorization: <YOUR_API_TOKEN>' \
140167
--data '{
141-
"leaf_type": "campaign",
142-
"id": "<OBJECT_ID>",
168+
"id": "don:core:dvrv-us-1:devo/11FVC3ScK:custom_object/campaign/1",
143169
"custom_fields": {
144-
"budget": 15000
170+
"tnt__budget": 15000
145171
}
146172
}'
147173
```
@@ -156,8 +182,8 @@ curl --location 'https://api.devrev.ai/custom-objects.delete' \
156182
--header 'Accept: application/json' \
157183
--header 'Authorization: <YOUR_API_TOKEN>' \
158184
--data '{
159-
"id": "<OBJECT_ID>"
160-
}
185+
"id": "don:core:dvrv-us-1:devo/11FVC3ScK:custom_object/campaign/1"
186+
}'
161187
```
162188

163189
## Key Concepts
@@ -167,7 +193,7 @@ curl --location 'https://api.devrev.ai/custom-objects.delete' \
167193
3. **Custom Fields**: User-defined fields that store specific data for your custom object.
168194
4. **Unique Key**: A unique identifier for each custom object, useful for maintaining idempotency.
169195

170-
For more details, please refer to the [Customization](./customization.mdx) documentation.
196+
For more details on customization concepts, please refer to the [Customization](./customization.mdx) documentation.
171197

172198
## Custom Object Lifecycle
173199

fern/versions/beta.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,7 @@ navigation:
1313
contents:
1414
- page: Object Customization
1515
path: ../docs/pages/customization.mdx
16+
- page: Custom Objects
17+
path: ../docs/pages/custom-objects.mdx
1618
- page: Create accounts and contacts in DevRev
1719
path: ../docs/pages/create-accounts.mdx

0 commit comments

Comments
 (0)