Convert 1.0.0

The Convert service is a proprietary, non-PromoStandards-based service that can be used to perform conversions between data formats, including JSON and XML.


Functions Supported

The Search service supports these functions:


HTTP Method and URL

HTTP Method: POST
URL: https://api.promo.zone/


convertJSONtoXML Requests

The function supports the following parameters.

Parameter Description Required
apiKey The Promo.zone API Key that has been assigned to you. Note that this is not an ID assigned to you by suppliers. Yes
service The PromoStandards service being requested. (Convert) Yes
version The version of the service. (1.0.0) Yes
function The PromoStandards Convert API function being requested. (convertJSONtoXML) Yes
json The JSON to be converted. Yes

Example Request

{
  "apiKey": "** Your Promo.zone API Key **",
  "service": "Convert", 
  "version": "1.0.0",
  "function": "convertJSONtoXML",
  "json": {
    "firstName": "John",
    "lastName": "Smith",
    "isAlive": true,
    "age": 27,
    "address": {
      "streetAddress": "21 2nd Street",
      "city": "New York",
      "state": "NY",
      "postalCode": "10021-3100"
    },
    "phoneNumbers": [
      {
        "type": "home",
        "number": "212 555-1234"
      },
      {
        "type": "office",
        "number": "646 555-4567"
      },
      {
        "type": "mobile",
        "number": "123 456-7890"
      }
    ],
    "children": [],
    "spouse": null
  } 
}		
			

Example Response

<?xml version="1.0"?>
<converted>
  <firstName>John</firstName>
  <lastName>Smith</lastName>
  <isAlive>1</isAlive>
  <age>27</age>
  <address>
    <streetAddress>21 2nd Street</streetAddress>
    <city>New York</city>
    <state>NY</state>
    <postalCode>10021-3100</postalCode>
  </address>
  <phoneNumbers>
    <element0>
      <type>home</type>
      <number>212 555-1234</number>
    </element0>
    <element1>
      <type>office</type>
      <number>646 555-4567</number>
    </element1>
    <element2>
      <type>mobile</type>
      <number>123 456-7890</number>
    </element2>
  </phoneNumbers>
  <children/>
  <spouse/>
</converted>
			

convertXMLtoJSON Requests

The function supports the following parameters.

Parameter Description Required
apiKey The Promo.zone API Key that has been assigned to you. Note that this is not an ID assigned to you by suppliers. Yes
service The PromoStandards service being requested. (Convert) Yes
version The version of the service. (1.0.0) Yes
function The PromoStandards Convert API function being requested. (convertXMLtoJSON) Yes
xml The XML to be converted. Yes

Example Request

{
  "apiKey": "** Your Promo.zone API Key **",
  "service": "Convert", 
  "version": "1.0.0",
  "function": "convertXMLtoJSON",
  "xml": "<contact>
  <firstName>John</firstName>
  <lastName>Smith</lastName>
  <isAlive>1</isAlive>
  <age>27</age>
  <address>
    <streetAddress>21 2nd Street</streetAddress>
    <city>New York</city>
    <state>NY</state>
    <postalCode>10021-3100</postalCode>
  </address>
  <phoneNumbers>
    <element0>
      <type>home</type>
      <number>212 555-1234</number>
    </element0>
    <element1>
      <type>office</type>
      <number>646 555-4567</number>
    </element1>
    <element2>
      <type>mobile</type>
      <number>123 456-7890</number>
    </element2>
  </phoneNumbers>
  <children/>
  <spouse/>
</contact>"
}	
			

Example Response

{
    "contact": {
        "firstName": "John",
        "lastName": "Smith",
        "isAlive": "1",
        "age": "27",
        "address": {
            "streetAddress": "21 2nd Street",
            "city": "New York",
            "state": "NY",
            "postalCode": "10021-3100"
        },
        "phoneNumbers": {
            "element0": {
                "type": "home",
                "number": "212 555-1234"
            },
            "element1": {
                "type": "office",
                "number": "646 555-4567"
            },
            "element2": {
                "type": "mobile",
                "number": "123 456-7890"
            }
        },
        "children": {},
        "spouse": {}
    }
}
			

© Copyright 2019 Dietrich Enterprises, LLC.