Editing & deleting data
Editing existing items in Pipeless is limited to changing the ID's of current objects. When you would like to delete data from Pipeless, you have the option to either delete a single object, all objects of that type or a specific relationship between two objects. Deleting objects is immediate and permanent, please be certain you don't want that data before deleting.
Edit an object ID
If your instinct is to delete your data and try again, the deleting options below will work well for that, but if all you want to do is adjust some object ID's, take a look at the Edit Object endpoint.
const data = JSON.stringify({
"object": {
"id": "127.0.0.1",
"type": "user"
},
"new_props": {
"id": "Tim"
}
});
const xhr = new XMLHttpRequest();
xhr.addEventListener("readystatechange", function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open("PATCH", "https://api.pipeless.io/v1/apps/123/objects");
xhr.setRequestHeader("accept", "application/json");
xhr.setRequestHeader("content-type", "application/json");
xhr.send(data);
import requests
url = "https://api.pipeless.io/v1/apps/123/objects"
payload = {
"object": {
"id": "127.0.0.1",
"type": "user"
},
"new_props": {"id": "Tim"}
}
headers = {
"accept": "application/json",
"content-type": "application/json"
}
response = requests.request("PATCH", url, json=payload, headers=headers)
print(response.text)
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://api.pipeless.io/v1/apps/123/objects")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Patch.new(url)
request["accept"] = 'application/json'
request["content-type"] = 'application/json'
request.body = "{\"object\":{\"id\":\"127.0.0.1\",\"type\":\"user\"},\"new_props\":{\"id\":\"Tim\"}}"
response = http.request(request)
puts response.read_body
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.pipeless.io/v1/apps/123/objects",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => "{\"object\":{\"id\":\"127.0.0.1\",\"type\":\"user\"},\"new_props\":{\"id\":\"Tim\"}}",
CURLOPT_HTTPHEADER => [
"accept: application/json",
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"object\":{\"id\":\"127.0.0.1\",\"type\":\"user\"},\"new_props\":{\"id\":\"Tim\"}}");
Request request = new Request.Builder()
.url("https://api.pipeless.io/v1/apps/123/objects")
.patch(body)
.addHeader("accept", "application/json")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
curl --request PATCH \
--url https://api.pipeless.io/v1/apps/123/objects \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '{"object":{"id":"127.0.0.1","type":"user"},"new_props":{"id":"Tim"}}'
In this example, you're in App ID 123 finding all objects of type "user" with the id "127.0.0.1" and switching out those object id's with the new id "Tim." This retains all of the object relationships that were set for user "127.0.0.1" so no data is lost in this process.
Using this process for temporary user id's is one way to handle when you have anonymous users who later sign up or log in and you want to reconcile their anonymous activity with their known logged in identity. We recommend using unique alphanumeric id's for users, so please consider when to use private identifiable information in stored user id's.
API Reference Documentation
You can read the reference docs for this endpoint here:
Edit Object
Delete a single object
This deletes just one object and all relationships to and from that object.
const data = JSON.stringify({
"object": {
"id": "Tim",
"type": "user"
}
});
const xhr = new XMLHttpRequest();
xhr.addEventListener("readystatechange", function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open("DELETE", "https://api.pipeless.io/v1/apps/123/objects");
xhr.setRequestHeader("accept", "application/json");
xhr.setRequestHeader("content-type", "application/json");
xhr.send(data);
import requests
url = "https://api.pipeless.io/v1/apps/123/objects"
payload = {"object": {
"id": "Tim",
"type": "user"
}}
headers = {
"accept": "application/json",
"content-type": "application/json"
}
response = requests.request("DELETE", url, json=payload, headers=headers)
print(response.text)
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://api.pipeless.io/v1/apps/123/objects")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Delete.new(url)
request["accept"] = 'application/json'
request["content-type"] = 'application/json'
request.body = "{\"object\":{\"id\":\"Tim\",\"type\":\"user\"}}"
response = http.request(request)
puts response.read_body
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.pipeless.io/v1/apps/123/objects",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_POSTFIELDS => "{\"object\":{\"id\":\"Tim\",\"type\":\"user\"}}",
CURLOPT_HTTPHEADER => [
"accept: application/json",
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"object\":{\"id\":\"Tim\",\"type\":\"user\"}}");
Request request = new Request.Builder()
.url("https://api.pipeless.io/v1/apps/123/objects")
.delete(body)
.addHeader("accept", "application/json")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
curl --request DELETE \
--url https://api.pipeless.io/v1/apps/123/objects \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '{"object":{"id":"Tim","type":"user"}}'
In this example, the object user "Tim" is being deleted from App ID 123. This would also delete any relationship between that user and other objects, so for example, if Tim had "liked" relationships with any content objects those relationships would also be deleted in the process. It will not delete any other objects connected through those relationships.
API Reference Documentation
You can read the reference docs for this endpoint here:
Delete Object
User Data
To comply with data regulations, you may be required to delete all records of a user, which you can do easily and immediately with the Delete Object endpoint. This will permanently delete that user and all of the activity (event relationships) attributed to them in Pipeless.
Delete all objects of a specified type
This deletes all objects of a certain type and all relationships to and from those objects.
const data = JSON.stringify({
"object_type": "skill"
});
const xhr = new XMLHttpRequest();
xhr.addEventListener("readystatechange", function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open("DELETE", "https://api.pipeless.io/v1/apps/123/objects/all");
xhr.setRequestHeader("accept", "application/json");
xhr.setRequestHeader("content-type", "application/json");
xhr.send(data);
import requests
url = "https://api.pipeless.io/v1/apps/123/objects/all"
payload = {"object_type": "skill"}
headers = {
"accept": "application/json",
"content-type": "application/json"
}
response = requests.request("DELETE", url, json=payload, headers=headers)
print(response.text)
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://api.pipeless.io/v1/apps/123/objects/all")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Delete.new(url)
request["accept"] = 'application/json'
request["content-type"] = 'application/json'
request.body = "{\"object_type\":\"skill\"}"
response = http.request(request)
puts response.read_body
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.pipeless.io/v1/apps/123/objects/all",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_POSTFIELDS => "{\"object_type\":\"skill\"}",
CURLOPT_HTTPHEADER => [
"accept: application/json",
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"object_type\":\"skill\"}");
Request request = new Request.Builder()
.url("https://api.pipeless.io/v1/apps/123/objects/all")
.delete(body)
.addHeader("accept", "application/json")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
curl --request DELETE \
--url https://api.pipeless.io/v1/apps/123/objects/all \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '{"object_type":"skill"}'
In this example, all objects of type "skill" are being deleted from App ID 123. This would also delete any objects with a relationship to any skill object, so for example, the skill "photography" would be deleted along with any other skill like "painting," "sculpture," etc. and if any users had "liked" relationships with any of those skills, those relationships would also be deleted in the process.
API Reference Documentation
You can read the reference docs for this endpoint here:
Delete All Objects by Type
Delete a relationship (event)
This deletes the targeted relationship(s) that match the specified object-relationship-object structure. It has to be an exact match for all three items: start object (id & type), relationship (type) and end object (id & type). The relationship direction (start vs. end) also must match. If you don't set a created date, it can delete multiple relationships that match where the same relationships have been added with different time stamps. Only relationships are deleted with this request, not the objects that have that relationship.
const data = JSON.stringify({
"event": {
"start_object": {
"id": "Tim",
"type": "user"
},
"relationship": {
"type": "liked"
},
"end_object": {
"id": "Article 123",
"type": "article"
}
}
});
const xhr = new XMLHttpRequest();
xhr.addEventListener("readystatechange", function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open("DELETE", "https://api.pipeless.io/v1/apps/123/events");
xhr.setRequestHeader("accept", "application/json");
xhr.setRequestHeader("content-type", "application/json");
xhr.send(data);
import requests
url = "https://api.pipeless.io/v1/apps/123/events"
payload = {"event": {
"start_object": {
"id": "Tim",
"type": "user"
},
"relationship": {"type": "liked"},
"end_object": {
"id": "Article 123",
"type": "article"
}
}}
headers = {
"accept": "application/json",
"content-type": "application/json"
}
response = requests.request("DELETE", url, json=payload, headers=headers)
print(response.text)
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://api.pipeless.io/v1/apps/123/events")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Delete.new(url)
request["accept"] = 'application/json'
request["content-type"] = 'application/json'
request.body = "{\"event\":{\"start_object\":{\"id\":\"Tim\",\"type\":\"user\"},\"relationship\":{\"type\":\"liked\"},\"end_object\":{\"id\":\"Article 123\",\"type\":\"article\"}}}"
response = http.request(request)
puts response.read_body
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.pipeless.io/v1/apps/123/events",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_POSTFIELDS => "{\"event\":{\"start_object\":{\"id\":\"Tim\",\"type\":\"user\"},\"relationship\":{\"type\":\"liked\"},\"end_object\":{\"id\":\"Article 123\",\"type\":\"article\"}}}",
CURLOPT_HTTPHEADER => [
"accept: application/json",
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"event\":{\"start_object\":{\"id\":\"Tim\",\"type\":\"user\"},\"relationship\":{\"type\":\"liked\"},\"end_object\":{\"id\":\"Article 123\",\"type\":\"article\"}}}");
Request request = new Request.Builder()
.url("https://api.pipeless.io/v1/apps/123/events")
.delete(body)
.addHeader("accept", "application/json")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
curl --request DELETE \
--url https://api.pipeless.io/v1/apps/123/events \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '{"event":{"start_object":{"id":"Tim","type":"user"},"relationship":{"type":"liked"},"end_object":{"id":"Article 123","type":"article"}}}'
In this example, any relationship with a start object user "Tim" that "liked" end object article "Article 123" will be deleted. This will delete multiple instances of the relationship "Tim (user) liked Article 123 (article)" if that same relationship has been added with multiple different "created_on" time stamps. Types must match, so for example, it would not delete the relationship "Tim (user) liked Article 123 (post)" since the type "post" is different than type "article" that was requested to be deleted. Neither object "Tim" nor "Article 123" would be deleted, just the "liked" relationship between them.
API Reference Documentation
You can read the reference docs for this endpoint here:
Delete Event
Delete all relationships with an object (of a type)
This is the same endpoint the previous "Delete a relationship (event)" but used differently where here you are not specifying an exact end object, just an end object type. This will delete all relationships between the specified start object and all objects of the end object type. This only deletes relationships, no objects will be deleted. This will only work in one direction with the "all" param being on the end object.
const data = JSON.stringify({
"event": {
"start_object": {
"id": "Article 123",
"type": "article"
},
"relationship": {
"type": "taggedWith"
},
"end_object": {
"type": "tag",
"all": true
}
}
});
const xhr = new XMLHttpRequest();
xhr.addEventListener("readystatechange", function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open("DELETE", "https://api.pipeless.io/v1/apps/123/events");
xhr.setRequestHeader("accept", "application/json");
xhr.setRequestHeader("content-type", "application/json");
xhr.send(data);
import requests
url = "https://api.pipeless.io/v1/apps/123/events"
payload = {"event": {
"start_object": {
"id": "Article 123",
"type": "article"
},
"relationship": {"type": "taggedWith"},
"end_object": {
"type": "tag",
"all": true
}
}}
headers = {
"accept": "application/json",
"content-type": "application/json"
}
response = requests.request("DELETE", url, json=payload, headers=headers)
print(response.text)
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://api.pipeless.io/v1/apps/123/events")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Delete.new(url)
request["accept"] = 'application/json'
request["content-type"] = 'application/json'
request.body = "{\"event\":{\"start_object\":{\"id\":\"Article 123\",\"type\":\"article\"},\"relationship\":{\"type\":\"taggedWith\"},\"end_object\":{\"type\":\"article\",\"all\":true}}}"
response = http.request(request)
puts response.read_body
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.pipeless.io/v1/apps/123/events",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_POSTFIELDS => "{\"event\":{\"start_object\":{\"id\":\"Article 123\",\"type\":\"article\"},\"relationship\":{\"type\":\"taggedWith\"},\"end_object\":{\"type\":\"article\",\"all\":true}}}",
CURLOPT_HTTPHEADER => [
"accept: application/json",
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"event\":{\"start_object\":{\"id\":\"Article 123\",\"type\":\"article\"},\"relationship\":{\"type\":\"taggedWith\"},\"end_object\":{\"type\":\"article\",\"all\":true}}}");
Request request = new Request.Builder()
.url("https://api.pipeless.io/v1/apps/123/events")
.delete(body)
.addHeader("accept", "application/json")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
curl --request DELETE \
--url https://api.pipeless.io/v1/apps/123/events \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '{"event":{"start_object":{"id":"Article 123","type":"article"},"relationship":{"type":"taggedWith"},"end_object":{"type":"tag","all":true}}}'
The example above will find the article object "Article 123" and delete all the "taggedWith" relationships it has with any "tag" object. It does not delete the article or the tags, those remain intact, only the connecting relationships are deleted. After this, "Article 123" will not appear to have any associated tags.
API Reference Documentation
You can read the reference docs for this endpoint here:
Delete Event
Delete an app
If you want to start fresh, you can delete your entire app and all stored data. You can read how to delete an app here: Deleting an app
Client libraries
The examples above can also be executed by utilizing our client libraries:
Node Client Library
PHP Client Library
Updated over 1 year ago