create or remove print subscription
1 min
POST
https://api.upstartcommerce.com/v1/customer/subscriptions/print/{listId}/subscription
Path Parameters
- listIdstring<uuid>requiredDescriptionFormatuuid
Header Parameters
- x-upstart-tenantstringrequiredDescription
- x-upstart-sitestringDescription
Body Parameters
- bodyCreateOrRemovePrintSubscriptionRequestrequiredDescription
- intentstring<Create | Remove>requiredDescriptionAllowedCreateRemove
- detailsPrintSubscriptionDetailsrequiredDescription
- firstNamestringrequiredExampleDescription
- lastNamestringrequiredExampleDescription
- businessNamestringExampleDescription
- emailstring<email>ExampleDescriptionFormatemail
- phonestringExampleDescription
- addressPrintAddressrequiredDescription
- addressLine1stringrequiredExampleDescription
- addressLine2stringDescription
- citystringrequiredExampleDescription
- statestringrequiredExampleDescription
- zipstringrequiredExampleDescription
Responses
201
- PrintSubscriptionDescription
- idstringrequiredExampleDescription
- detailsPrintSubscriptionDetailsrequiredDescription
- firstNamestringrequiredExampleDescription
- lastNamestringrequiredExampleDescription
- businessNamestringExampleDescription
- emailstring<email>ExampleDescriptionFormatemail
- phonestringExampleDescription
- addressPrintAddressrequiredDescription
- addressLine1stringrequiredExampleDescription
- addressLine2stringDescription
- citystringrequiredExampleDescription
- statestringrequiredExampleDescription
- zipstringrequiredExampleDescription
- intentstring<Create | Remove>requiredExampleDescriptionAllowedCreateRemove
- dateModifiedstring<date-time>requiredExampleDescriptionFormatdate-time
400
- ValidationErrorResponseDescription
- namestringrequired
- codestringrequired
- detailstring
401
- ErrorResponseDescription
- namestringrequired
- codestringrequired
- detailstringrequired
- reasonstring
404
- ErrorResponseDescription
- namestringrequired
- codestringrequired
- detailstringrequired
- reasonstring
curl
curl --request POST \
--url https://api.upstartcommerce.com/v1/customer/subscriptions/print/{listId}/subscription \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--header 'x-upstart-tenant: string' \
--data '{
"intent": "",
"details": {
"firstName": "John",
"lastName": "Doe",
"address": {
"addressLine1": "My Street 1",
"city": "New York",
"state": "New York",
"zip": "10001"
}
}
}'javascript
var myHeaders = new Headers();
myHeaders.append("accept", "application/json");
myHeaders.append("content-type", "application/json");
myHeaders.append("x-upstart-tenant", "string");
var raw = JSON.stringify({
"intent": "",
"details": {
"firstName": "John",
"lastName": "Doe",
"address": {
"addressLine1": "My Street 1",
"city": "New York",
"state": "New York",
"zip": "10001"
}
}
});
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch("https://api.upstartcommerce.com/v1/customer/subscriptions/print/{listId}/subscription", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));ruby
require "uri"
require "json"
require "net/http"
url = URI("https://api.upstartcommerce.com/v1/customer/subscriptions/print/{listId}/subscription")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["accept"] = "application/json"
request["content-type"] = "application/json"
request["x-upstart-tenant"] = "string"
request.body = JSON.dump({
"intent": "",
"details": {
"firstName": "John",
"lastName": "Doe",
"address": {
"addressLine1": "My Street 1",
"city": "New York",
"state": "New York",
"zip": "10001"
}
}
})
response = https.request(request)
puts response.read_body
python
import requests
import json
url = "https://api.upstartcommerce.com/v1/customer/subscriptions/print/{listId}/subscription"
payload = json.dumps({
"intent": "",
"details": {
"firstName": "John",
"lastName": "Doe",
"address": {
"addressLine1": "My Street 1",
"city": "New York",
"state": "New York",
"zip": "10001"
}
}
})
headers = {
'accept': 'application/json',
'content-type': 'application/json',
'x-upstart-tenant': 'string'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
201
// Success - print subscription created or removed.
{
"id": "ced8ef74-c968-47f6-98e0-d780d3da85fb",
"details": {
"firstName": "John",
"lastName": "Doe",
"businessName": "Company Corporation",
"email": "[email protected]",
"phone": "8668675309",
"address": {
"addressLine1": "My Street 1",
"addressLine2": "",
"city": "New York",
"state": "New York",
"zip": "10001"
}
},
"intent": "Create",
"dateModified": "2017-07-21T17:32:28Z"
}400
// The request contained information that the server was unable to process. Appropriate errors are provided in the response body.
{
"name": "",
"code": "",
"detail": ""
}401
// The provided credentials were not valid for this endpoint. It may be that they are expired or that the user's roles are insufficient.
{
"name": "",
"code": "",
"detail": "",
"reason": ""
}404
// The requested resource was not found in the NoChannel system.
{
"name": "",
"code": "",
"detail": "",
"reason": ""
}