Use this endpoint to schedule an individual or a group of individuals for a GDPR job.
services/v2/jobs/gdpr/schedule.json
- URL (Path/Query) Params
No query params needed; no path param needed.
- Data Params
No data params
- Request Body
1a. If you select the bulk operation, then the user needs to provide the CSV file ID key-value pair.
1b. If it’s an individual operation, then you need the user key with any of the three optional values.
2. Schedule Date - as "scheduleDate" : <timestamp...see Note on Formats for Dates and timeStamps:>
- Sample Request Body:
- For bulk:
{
"csvFileId":id-returned-by-upload-endpoint,
"scheduleDate":"<timestamp>",
"operations":[
"<see operations>"
]
}- For individual:
{
"user":{
"username":"<optional>",
"email":"<optional>",
"id":"<optional>"
},
"scheduleTime":"<timestamp>",
"operations":[
"<see operations>"
]
},
{
"operations":[
"anonymize",
"delete"
]
}Must pick one of the options for "user" and "operations"
- For the “user” object and the "Operations" array, we require one of the optional keys.
- User Types: username, email, or ID.
- Operation Types: it’s a list that can contain at most 4 elements [suspend, anonymize, delete, anon-delete]:
Note on Formats for Dates and timeStamps:
-
Schedule date:
Option 1: "scheduleDate" : { "formatted" : "month/day/year hour:second" }
- eg: 10/07/2018 10:26 Option 2: "scheduleDate" : { "timeStamp" : "<time in millis>" }
For Permissions, Requirements, and More Detailed Information:Reference the GDPR Plugin Docs in the Non-Reference portion of the documentation.
Sample Requests
Sample Request Using Bulk:
Call:
url -X POST -u <user>:<password> -H "Accept:applicaton/json" -H "Content-Type: application/json" "https://apidocs.cloud.answerhub.com/services/v2/jobs/gdpr/schedule.json" -d '{ "csvFileId": "<file id>", "scheduleDate": {"formatted": "<formatted date>"}, "operations" : ["<operation>"], "type":"bulk"}'
curl
-X POST
-u piero:mypass
-H "Accept:applicaton/json"
-H "Content-Type: application/json" "https://apidocs.cloud.answerhub.com/services/v2/jobs/gdpr/schedule.json"
-d '{"csvFileId": "<file id>", "scheduleDate": {"formatted": "10/15/2018 12:22"}, "operations" : ["anonymize"], "type":"bulk"}'Sample Request For A Single User:
Call:
curl -X POST -u <user>:<password> -H "Accept:application/json" -H "Content-Type: application/json" "https://apidocs.cloud.answerhub.com/services/v2/jobs/gdpr/schedule.json" -d '{ "user" : {"username":"<username to be GDPRed>"}, "scheduleDate": {"formatted": "<formatted execution date>"}, "reassignUser" : {"username" : "<reassign username>"}, "operations" : ["<operation type>"], "type" : "individual"}'
curl
-X POST
-u piero:mypass
-H "Accept:application/json"
-H "Content-Type: application/json" "https://apidocs.cloud.answerhub.com/services/v2/jobs/gdpr/schedule.json"
-d '{"user" : {"username":"pz10"},
"scheduleDate": {"formatted": "10/15/2018 12:02"},
"reassignUser" : {"username" : "piero"},
"operations" : ["suspend"], "type" : "individual"}'Example Of Incorrect Sample Requests
Example with incorrect user section specified:
curl
-X POST
-u piero:mypass
-H "Accept:applicaton/json"
-H "Content-Type: application/json" "https://apidocs.cloud.answerhub.com/services/v2/jobs/gdpr/schedule.json"
-d '{"user": {"username" : "pz10"}, "scheduleDate": {"formatted": "10/10/2018 12:22"}, "operations" : ["anonymize"], "type":"individual"}'Example with bulk schedule in mind, but no type: bulk specified:
curl
-X POST
-u piero:mypass
-H "Accept:application/json"
-H "Content-Type: application/json" "https://apidocs.cloud.answerhub.com/services/v2/jobs/gdpr/schedule.json"
-d '{"csvFileId": 562, "scheduleDate": {"formatted": "10/10/2018 12:21"}, "operations" : ["anonymize"]}'Expected Responses
- Success Response:
Code: 201 created
Content: {"jobId”: "<id-value>"}
- Error Response:
- No user selected: HTTP/1.1 400 Bad Request
{"error": "The individual type was selected, but the request is missing the user"}
- file id not specified: HTTP/1.1 400 Bad Request
{"error": "The bulk type was selected, but the request is missing the csvFileId field."}
- file id does not exist: HTTP/1.1 400 Bad Request
{"error": "The requested file does not exist"}
- There is a job already scheduled for that timeframe: HTTP/1.1 400 Bad Request
{"error": "There is a job already scheduled for that time frame."}
- The selected date is not eligible: HTTP/1.1 400 Bad Request
{"error": "The desired date is in the past and is it not eligible."}
- Empty operations list was submitted: HTTP/1.1 400 Bad Request
{"error":"The provided 'operations' is/are invalid"}
- Reassign user with more than one way of identifying who they are. (eg:"reassignUser" : {"id" : 7, "username" : "piero"}) HTTP/1.1 400 Bad Request
{"error": "The request contains more than one reassignUser eligible configuration"}
- The reassign user does not exist: HTTP/1.1 400 Bad Request
{"error": "The provided 'reassignUser' is/are invalid"}
Sample Responses
Successful Response:
{
"jobId":"<id-value>"
}Error Response File ID Not Specified: HTTP/1.1 400 Bad Request
{
"error":"The bulk type was selected, but the request is missing the csvFileId field."
}Error Response File ID Does Not Exist: HTTP/1.1 400 Bad Request
{
"error":"The requested file does not exist"
}Error Response There Is A Job Already Scheduled For That Timeframe: HTTP/1.1 400 Bad Request
{
"error":"There is a job already scheduled for that time frame."
}Error Response The Selected Date Is Not Eligible: HTTP/1.1 400 Bad Request
{
"error":"The desired date is in the past and is it not eligible."
}Error Response Empty Operations List Was Submitted: HTTP/1.1 400 Bad Request
{
"error":"The provided 'operations' is/are invalid"
}Error Response Reassign User With More Than One Way Of Identifying Who They Are
{
"error":"The request contains more than one reassignUser eligible configuration"
}Error Response The Reassign User Does Not Exist: HTTP/1.1 400 Bad Request
{
"error":"The provided 'reassignUser' is/are invalid"
}