Create Content
1 min
POST
https://api.b.preview.loyaltyservices.io/api/v3/content
Body Parameters
- bodyGenericItemrequired
- contentCodestringrequiredExampleDescription
- contentTypeCodestringExampleDescription
- namestringExampleDescriptionMax Length50
- shortDescriptionstringExampleDescriptionMax Length500
- descriptionstringExampleDescription
- alternateDescriptionstringExampleDescription
- termsAndConditionsstringExampleDescription
- titlestringExampleDescriptionMax Length200
- labelstringExampleDescriptionMax Length255
- logoKeystringExampleDescription
- displayTypeKeystringExampleDescription
- startDatestring<date-time>DescriptionFormatdate-time
- endDatestring<date-time>DescriptionFormatdate-time
- urlstringExampleDescriptionMax Length1000
- tierCodestringExampleDescription
- displayForAllbooleanExampleDescription
- descriptorCodestringExampleDescription
Responses
200
- GenericItem
- contentCodestringrequiredExampleDescription
- contentTypeCodestringExampleDescription
- namestringExampleDescriptionMax Length50
- shortDescriptionstringExampleDescriptionMax Length500
- descriptionstringExampleDescription
- alternateDescriptionstringExampleDescription
- termsAndConditionsstringExampleDescription
- titlestringExampleDescriptionMax Length200
- labelstringExampleDescriptionMax Length255
- logoKeystringExampleDescription
- displayTypeKeystringExampleDescription
- startDatestring<date-time>DescriptionFormatdate-time
- endDatestring<date-time>DescriptionFormatdate-time
- urlstringExampleDescriptionMax Length1000
- tierCodestringExampleDescription
- displayForAllbooleanExampleDescription
- descriptorCodestringExampleDescription
400
- ErrorResponse
- errorsValidationError[]Description
- codestringDescription
- fieldNamestringDescription
- messagestringDescription
- messageParametersobject[]Description
401
403
500
curl
curl --request POST \
--url https://api.b.preview.loyaltyservices.io/api/v3/content \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '{
"contentCode": "Bonus100"
}'ruby
require "uri"
require "json"
require "net/http"
url = URI("https://api.b.preview.loyaltyservices.io/api/v3/content")
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.body = JSON.dump({
"contentCode": "Bonus100"
})
response = https.request(request)
puts response.read_body
python
import requests
import json
url = "https://api.b.preview.loyaltyservices.io/api/v3/content"
payload = json.dumps({
"contentCode": "Bonus100"
})
headers = {
'accept': 'application/json',
'content-type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
java
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"contentCode\": \"Bonus100\"\n}");
Request request = new Request.Builder()
.url("https://api.b.preview.loyaltyservices.io/api/v3/content")
.method("POST", body)
.addHeader("accept", "application/json")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();200
// Success
{
"contentCode": "Bonus100",
"contentTypeCode": "HEADER",
"name": "Bonus 100 points",
"shortDescription": "Award 100 points",
"description": "Award 100 points on 100th stay",
"alternateDescription": "Award 100 points on 100th stay",
"termsAndConditions": "Terms and conditions for this promotion",
"title": "Award 100 points",
"label": "100 points awarded",
"logoKey": "100-points.png",
"displayTypeKey": "100 points",
"startDate": "",
"endDate": "",
"url": "/loyaltyprogram/bonus/100-points",
"tierCode": "B",
"displayForAll": true,
"descriptorCode": "LIMITED_TIME"
}400
// Bad request
{
"errors": [
{
"code": "",
"fieldName": "",
"message": "",
"messageParameters": [
{}
]
}
]
}401
// Unauthorized
403
// Forbidden
500
// Internal error