Skip to content

Commit cb17727

Browse files
Linh NguyenGitHub Enterprise
authored andcommitted
Merge pull request #6510 from AdobeDocs/PLAT-252804/Add-public-GitHub-example-for-identity-delete-payload-creation
PLAT-252804/Add-public-GitHub-example-for-identity-delete-payload-creation[READY]
2 parents fbdaaaa + 1e8087c commit cb17727

File tree

1 file changed

+104
-0
lines changed

1 file changed

+104
-0
lines changed

help/hygiene/api/workorder.md

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,110 @@ The following table describes the properties in the response.
295295
>
296296
>The action property for record delete work orders is currently `identity-delete` in API responses. If the API changes to use a different value (such as `delete_identity`), this documentation will be updated accordingly.
297297
298+
## Convert ID lists to JSON for record delete requests
299+
300+
To create a record delete work order from CSV, TSV, or TXT files containing identifiers, you can use conversion scripts to produce the required JSON payloads for the `/workorder` endpoint. This approach is especially helpful when working with existing data files. For ready-to-use scripts and comprehensive instructions, visit the [csv-to-data-hygiene GitHub repository](https://github.com/perlmonger42/csv-to-data-hygiene).
301+
302+
### Generate JSON payloads
303+
304+
The following bash script examples demonstrate how to run the conversion scripts in Python or Ruby:
305+
306+
>[!BEGINTABS]
307+
308+
>[!TAB Example to run Python script]
309+
310+
```bash
311+
#!/usr/bin/env bash
312+
313+
rm -rf ./output && mkdir output
314+
for NAME in UTF8 CSV TSV TXT XYZ big; do
315+
./csv-to-DI-payload.py sample/sample-$NAME.* \
316+
--verbose \
317+
--column 2 \
318+
--namespace email \
319+
--dataset-id 66f4161cc19b0f2aef3edf10 \
320+
--description 'a simple sample' \
321+
--output-dir output
322+
echo Checking output/sample-$NAME-*.json against expect/sample-$NAME-*.json
323+
diff <(cat output/sample-$NAME-*.json) <(cat expect/sample-$NAME-*.json) || echo Unexpected output in sample-$NAME-*.*
324+
done
325+
```
326+
327+
>[!TAB Example to run Ruby script]
328+
329+
```bash
330+
#!/usr/bin/env bash
331+
332+
rm -rf ./output && mkdir output
333+
for NAME in UTF8 CSV TSV TXT XYZ big; do
334+
./csv-to-DI-payload.rb sample/sample-$NAME.* \
335+
--verbose \
336+
--column 2 \
337+
--namespace email \
338+
--dataset-id 66f4161cc19b0f2aef3edf10 \
339+
--description 'a simple sample' \
340+
--output-dir output
341+
echo Checking output/sample-$NAME-*.json against expect/sample-$NAME-*.json
342+
diff <(cat output/sample-$NAME-*.json) <(cat expect/sample-$NAME-*.json) || echo Unexpected output in sample-$NAME-*.*
343+
done
344+
```
345+
346+
>[!ENDTABS]
347+
348+
The table below describes the parameters in the bash scripts.
349+
350+
| Parameter | Description |
351+
| --- | --- |
352+
| `verbose` | Enable verbose output. |
353+
| `column` | The index (1-based) or header name of the column containing the identity values to delete. Defaults to the first column if not specified. |
354+
| `namespace` | An object with a `code` property specifying the identity namespace (for example, "email"). |
355+
| `dataset-id` | The unique identifier for the dataset associated with the work order. If the request applies to all datasets, this field will be set to `ALL`. |
356+
| `description` | A description of the record delete work order. |
357+
| `output-dir` | The directory to write the output JSON payload. |
358+
359+
{style="table-layout:auto"}
360+
361+
The example below shows a successful JSON payload converted from a CSV, TSV, or TXT file. It contains records associated with the specified namespace and is used to delete records identified by email addresses.
362+
363+
```json
364+
{
365+
"action": "delete_identity",
366+
"datasetId": "66f4161cc19b0f2aef3edf10",
367+
"displayName": "output/sample-big-001.json",
368+
"description": "a simple sample",
369+
"identities": [
370+
{
371+
"namespace": {
372+
"code": "email"
373+
},
374+
"id": "1"
375+
},
376+
{
377+
"namespace": {
378+
"code": "email"
379+
},
380+
"id": "2"
381+
}
382+
]
383+
}
384+
```
385+
386+
The following table describes the properties in the JSON payload.
387+
388+
| Property | Description |
389+
| --- | --- |
390+
| `action` | The action requested for the record delete work order. Automatically set to `delete_identity` by the conversion script. |
391+
| `datasetId` | The unique identifier for the dataset. |
392+
| `displayName`| A human-readable label for this record delete work order. |
393+
| `description`| A description of the record delete work order. |
394+
| `identities` | An array of objects, each containing:<br><ul><li> `namespace`: An object with a `code` property specifying the identity namespace (for example, "email").</li><li> `id`: The identity value to delete for this namespace.</li></ul> |
395+
396+
{style="table-layout:auto"}
397+
398+
### Submit the generated JSON data to the `/workorder` endpoint
399+
400+
To submit a request, follow the instructions in the [create a record delete work order](#create) section. Make sure to use the converted JSON payload as the request body (`-d`) when sending your `curl` POST request to the `/workorder` API endpoint.
401+
298402
## Retrieve details for a specific record delete work order {#lookup}
299403

300404
Retrieve information for a specific record delete work order by making a GET request to `/workorder/{WORKORDER_ID}`. The response includes action type, status, associated dataset and user information, and audit metadata.

0 commit comments

Comments
 (0)