AgileApps Support Wiki Pre Release

Difference between revisions of "REST API:promoCode Resource"

From AgileApps Support Wiki
imported>Aeric
(Created page with "{{subst:REST Resource}}")
 
imported>Aeric
 
(18 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
Manage [[Promotion Codes]] using the [[REST API]].
Manage __resourceName__ (record)s using the [[REST API]].


:''Learn more:'' REST API [[REST API#Conventions and Considerations|Conventions and Considerations]].
:''Learn more:'' REST API [[REST API#Conventions and Considerations|Conventions and Considerations]].
{{Note|Use this structure the same way you use the structure for man pages:<br/>Follow the presentation pattern, but if a section isn't needed, don't include the header.<br/>Also:
# Add an entry to the [[REST API:REST API CheatSheet|REST API CheatSheet]]
# Add an entry to the [[REST API]] (categorized) page
# Add an entry to the [[REST API:REST Resources (alphabetical)|REST Resources]] page
}}
===Requirements===
:* Requirement #1
:* Requirement #2


===Permissions===
===Permissions===
'''''Check [[Administrative Permissions]] for a list of possibilities'''''
{{ISV Configuration}}
{{PermissionRef|Access Control|use this resource.}}
{{PermissionRef|User Management|use this resource.}}
{{permissions|Use Development Features|use this resource.}}


===List All __resourceName__ (Record)s===
===Get All promoCode Records===
("Get" if complete records are returned. "List" if partial data is returned, requiring a second read to get a complete set of data. This comes before the GET, because typically it's called first to get the ID used in a specific-record GET.)


;Method:GET
;Method:GET
;URI:<tt><nowiki>https://{domain}/networking/rest/__resourceName__</nowiki></tt>
:Return all fields
;URI:<tt><nowiki>https://{domain}/networking/rest/__resourceName__?{query_parameters}</nowiki></tt>
{{Query Parameters|
:Introductory sentence, if any
:*<tt>parameter1</tt> - Description
:*<tt>parameter2</tt>
::* If TRUE, ...
::* If FALSE, ...}}
;Response:
:<syntaxhighlight lang="xml" enclose="div">
<platform>
    <__resourceName__>
        <id>...</id>
        <field>data</field>
        ...
    </__resourceName__>
    <__resourceName__>
        ...
    </__resourceName__>
    ...


    <message>
;URI
        <code>0</code>
<blockquote>
        <description>Success</description>
Use this URI to get all promoCode  records, with all fields for each record:
    </message>
:<tt><nowiki>https://{domain}/networking/rest/promoCode?fieldList=*</nowiki></tt>
    <recordCount>N</recordCount>      <!-- Number of __ records returned -->
</platform>
</syntaxhighlight>


:See also: [[REST API:Error Codes]]
To restrict the records returned or the fields returned, see the section that explains how to do a [[#Dynamic Search for promoCode Records|Dynamic Search for promoCode Records]]
</blockquote>


===Get a __resourceName__ Record===
===Get a promoCode Record===
;Method:GET
;Method:GET
   
   
;URI:<tt><nowiki>https://{domain}/networking/rest/__resourceName__/{recordId}</nowiki></tt>
;URI:<tt><nowiki>https://{domain}/networking/rest/promoCode/{promotionCode}</nowiki></tt>
:Return all fields
;URI:<tt><nowiki>https://{domain}/networking/rest/__resourceName__/{recordId}?{query_parameters}</nowiki></tt>
{{Query Parameters|
:Introductory sentence, if any
::*<tt>parameter1</tt> - Description
::*<tt>parameter2</tt>
:::* If <tt>true</tt>, ...
:::* If '''<tt>false</tt>''', ... ('''default''')}}


;Response:
;Response:
:<syntaxhighlight lang="xml" enclose="div">
:<syntaxhighlight lang="xml" enclose="div">
<platform>
<platform>
    <__resourceName__>
  <promoCode>
        <id>...</id>
      <code>...</code>
        <field>data</field>
      <name>...</name>
         ...
      <start_date>...</start_date>
    </__resourceName__>
      <expiration_date>...</expiration_date>
      <trial_days>...</trial_days>
      <no_of_users>...</no_of_users>
      <integration_capabilities>
        <connections>...</connections>
        <on_premise_connection>...</on_premise_connection>
        <stages>...</stages>
         <production_execution_unit>...</production_execution_unit>
      </integration_capabilities>
  </promoCode>


    <message>
  <message>
        <code>0</code>
      <code>0</code>
        <description>Success</description>
      <description>Success</description>
    </message>
  </message>
</platform>
</platform>
</syntaxhighlight>
</syntaxhighlight>
Line 92: Line 50:
:See also: [[REST API:Error Codes]]
:See also: [[REST API:Error Codes]]


===Add a __resourceName__ Record===
===Add a promoCode Record===


;Method:POST
;Method:POST
   
   
;URI:<tt><nowiki>https://{domain}/networking/rest/__resourceName__</nowiki></tt>  
;URI:<tt><nowiki>https://{domain}/networking/rest/promoCode</nowiki></tt>  


;Request:
;Request:
:<syntaxhighlight lang="xml" enclose="div">
:<syntaxhighlight lang="xml" enclose="div">
<platform>
<platform>
    <__resourceName__>
  <promoCode>
        <field>data</field>
      <code>...</code>
         ...
      <name>...</name>
    </__resourceName__>
      <start_date>...</start_date>
      <expiration_date>...</expiration_date>
      <trial_days>...</trial_days>
      <no_of_users>...</no_of_users>
      <integration_capabilities>
         <connections>...</connections>
        <on_premise_connection>...</on_premise_connection>
        <stages>...</stages>
        <production_execution_unit>...</production_execution_unit>
      </integration_capabilities>
  </promoCode>
</platform>
</platform>
</syntaxhighlight>
</syntaxhighlight>
Line 111: Line 79:
:<syntaxhighlight lang="xml" enclose="div">
:<syntaxhighlight lang="xml" enclose="div">
<platform>
<platform>
    <message>
  <message>
        <code>0</code>
      <code>0</code>
        <description>Success</description>
      <description>Success</description>
        <id>...</id>  <!-- ID of the newly created __resourceName__ -->
      <id>...</id>  <!-- ID of the newly created record -->
    </message>
  </message>
</platform>
</platform>
</syntaxhighlight>
</syntaxhighlight>
Line 121: Line 89:
:See also: [[REST API:Error Codes]]
:See also: [[REST API:Error Codes]]


===Update a __resourceName__ Record===
===Update a promoCode Record===
;Method:PUT
;Method:PUT
   
   
;URI:<tt><nowiki>https://{domain}/networking/rest/__resourceName__/{recordId}</nowiki></tt>  
;URI:<tt><nowiki>https://{domain}/networking/rest/promoCode/{promotionCode}</nowiki></tt>  


;Request:
;Request:
:<syntaxhighlight lang="xml" enclose="div">
:<syntaxhighlight lang="xml" enclose="div">
<platform>
<platform>
    <__resourceName__>
  <promoCode>
        <id>{recordId}</id>
      <code>...</code>
         ...
      <name>...</name>
    </__resourceName__>
      <start_date>...</start_date>
      <expiration_date>...</expiration_date>
      <trial_days>...</trial_days>
      <no_of_users>...</no_of_users>
      <integration_capabilities>
         <connections>...</connections>
        <on_premise_connection>...</on_premise_connection>
        <stages>...</stages>
        <production_execution_unit>...</production_execution_unit>
      </integration_capabilities>
  </promoCode>
</platform>
</platform>
</syntaxhighlight>
</syntaxhighlight>
Line 139: Line 117:
:<syntaxhighlight lang="xml" enclose="div">
:<syntaxhighlight lang="xml" enclose="div">
<platform>
<platform>
    <message>
  <message>
        <code>0</code>
      <code>0</code>
        <description>Success</description>
      <description>Success</description>
    </message>
  </message>
</platform>
</platform>
</syntaxhighlight>
</syntaxhighlight>
Line 148: Line 126:
:See also: [[REST API:Error Codes]]
:See also: [[REST API:Error Codes]]


===Delete a __resourceName__ Record ===
===Delete a promoCode Record ===


;Method:DELETE
;Method:DELETE


;URI:<tt><nowiki>https://{domain}/networking/rest/__resourceName__/{recordId}</nowiki></tt>
;URI:<tt><nowiki>https://{domain}/networking/rest/promoCode/{promotionCode}</nowiki></tt>


;Response:
;Response:
:<syntaxhighlight lang="xml" enclose="div">
:<syntaxhighlight lang="xml" enclose="div">
<platform>
<platform>
    <message>
  <message>
        <code>0</code>
      <code>0</code>
        <description>Success</description>
      <description>Success</description>
    </message>
  </message>
</platform>
</platform>
</syntaxhighlight>
</syntaxhighlight>
Line 166: Line 144:
:See also: [[REST API:Error Codes]]
:See also: [[REST API:Error Codes]]


===Dynamic Search for __resourceName__ Records===
===Dynamic Search for promoCode Records===
;Method:GET
;Method:GET


;URI:<tt><nowiki>https://{domain}/networking/rest/__resourceName__?{query_parameters}</nowiki></tt>
;URI:<tt><nowiki>https://{domain}/networking/rest/promoCode?{query_parameters}</nowiki></tt>
{{:REST API:Dynamic Search}}
{{:REST API:Dynamic Search}}


Line 175: Line 153:
:<syntaxhighlight lang="xml" enclose="div">
:<syntaxhighlight lang="xml" enclose="div">
<platform>
<platform>
     ....
  <promoCode>
    <message>
  </promoCode>
        <code>0</code>
     ...
        <description>Success</description>
  <message>
    </message>
      <code>0</code>  <!- The number of records returned -->
      <description>Success</description>
  </message>
</platform>
</platform>
</syntaxhighlight>
</syntaxhighlight>
Line 190: Line 170:
! Name!!Type!!Attribute!!Required on Add!!Description!!Additional Information
! Name!!Type!!Attribute!!Required on Add!!Description!!Additional Information
|-
|-
| id || String || align="center"|Read Only || || || [[Record Id]]
| code || String || align="center"|Writable on Add only || align="center"|[[File:Checkmark.gif|link=]]  
| Code the user enters for the promotion ||
|-
| name || String || ||  || Name of the promotion ||
|-
|-
| name || String || || align="center"|[[File:Checkmark.gif|link=]] || ||  
| start_date || String || || || Date the promotion starts ||  
|-
|-
| description || String || || || ||  
| end_date || String || || || Date the promotion ends ||  
|-
|-
| ...|| ... || ... || ... || ... || ...
| trial_days || String || || || Number of days in the trial period ||  
|-
| no_of_users || String || || || Number of users allowed in the tenant ||
<!--
|-
|-
| item || String || align="center"|Read Only || || description || AddlInfo
| item || String || align="center"|Read Only || || description || AddlInfo
|-
| item || String || || || description || AddlInfo
|-
|-
| item || String || || align="center"|[[File:Checkmark.gif|link=]] || description || AddlInfo
| item || String || || align="center"|[[File:Checkmark.gif|link=]] || description || AddlInfo
|-
-->
| item || String || align="center"|Writable on Add only || align="center"|[[File:Checkmark.gif|link=]] || description || AddlInfo


|-
|-
| subItem || Tag|| || align="center"|[[File:Checkmark.gif|link=]] || description || AddlInfo
| integration_capabilities || struct || || || structure (see below) ||  
 
|-
| ...|| ... || ... || ... || ... || ...


|-  
|-  
| colspan="6"  bgcolor="Azure" style="height:7px" |  <!-- SPACER ROW -->
| colspan="6"  bgcolor="Azure" style="height:7px" |  <!-- SPACER ROW -->


|-
| id || String || align="center"|Read Only || || Record ID ||
|-
|-
| date_modified || Date || align="center"|Read Only || || || [[UTC Format]]
| date_modified || Date || align="center"|Read Only || || || [[UTC Format]]
Line 224: Line 206:
| modified_id || Lookup || align="center"|Read Only || || || [[REST API:User Resource|User]] ID
| modified_id || Lookup || align="center"|Read Only || || || [[REST API:User Resource|User]] ID
|}
|}
-or-
:{| border="1" cellpadding="5" cellspacing="0"
! Name !! Type !! Attribute !! Default Value !! Description !! Additional Information
|-
| item || String || align="center"|Read Only || Default || description || AddlInfo
|-
| item || String ||  || Default || description || AddlInfo


;integration_capabilities:
:{| border="1" cellpadding="5" cellspacing="0" width="75%"
! Name !! Type !! Description
|-
|-
| subItem || Tag|| || || description || AddlInfo
| connections || String || rowspan="4"| These elements do not apply to the {{EnterpriseBrand}}. They apply to Integration Live. For more information, consult the relevant documentation.
 
|-
|-
| ...|| ... || ... || ... || ... || ...
| on_premise_connection || String
 
|-
| colspan="6"  bgcolor="Azure" style="height:7px" |  <!-- SPACER ROW -->
 
|-
|-
| date_modified || Date || align="center"|Read Only || || || [[UTC Format]]
| stages || String
|-
|-
| date_created || Date || align="center"|Read Only || || || [[UTC Format]]
| production_execution_unit || String  
|-
| created_id || Lookup || align="center"|Read Only  || || || [[REST API:User Resource|User]] ID
|-
| modified_id || Lookup || align="center"|Read Only || || || [[REST API:User Resource|User]] ID
|}
 
;subItem Tag:
:{| border="1" cellpadding="5" cellspacing="0"
! Name!!Type!!Attribute!!Required on Add!!Description!!Additional Information
|-
| field || String || || || descr  || addl info
|}
|}


Line 268: Line 230:
:* See the [[REST API:Error Codes]] for common Http error codes
:* See the [[REST API:Error Codes]] for common Http error codes
:* See the [{{DOCHOST}}/javadocs/constant-values.html javadoc constants] for a complete list of <tt>PlatformException</tt> error-code constants.
:* See the [{{DOCHOST}}/javadocs/constant-values.html javadoc constants] for a complete list of <tt>PlatformException</tt> error-code constants.
<!--ACTIVATE THE CATEGORY BELOW
<noinclude>
<noinclude>


[[Category:REST API|__resourceName__ Resource]]
[[Category:REST API|promoCode Resource]]
</noinclude>
</noinclude>
-->

Latest revision as of 03:06, 10 January 2015

Manage Promotion Codes using the REST API.

Learn more: REST API Conventions and Considerations.

Permissions

Lock-tiny.gif

Get All promoCode Records

Method
GET
URI

Use this URI to get all promoCode records, with all fields for each record:

https://{domain}/networking/rest/promoCode?fieldList=*

To restrict the records returned or the fields returned, see the section that explains how to do a Dynamic Search for promoCode Records

Get a promoCode Record

Method
GET
URI
https://{domain}/networking/rest/promoCode/{promotionCode}
Response
<syntaxhighlight lang="xml" enclose="div">

<platform>

  <promoCode>
     ...
     <name>...</name>
     <start_date>...</start_date>
     <expiration_date>...</expiration_date>
     <trial_days>...</trial_days>
     <no_of_users>...</no_of_users>
     <integration_capabilities>
        <connections>...</connections>
        <on_premise_connection>...</on_premise_connection>
        <stages>...</stages>
        <production_execution_unit>...</production_execution_unit>
     </integration_capabilities>
  </promoCode>
  <message>
     0
     <description>Success</description>
  </message>

</platform> </syntaxhighlight>

See also: REST API:Error Codes

Add a promoCode Record

Method
POST
URI
https://{domain}/networking/rest/promoCode
Request
<syntaxhighlight lang="xml" enclose="div">

<platform>

  <promoCode>
     ...
     <name>...</name>
     <start_date>...</start_date>
     <expiration_date>...</expiration_date>
     <trial_days>...</trial_days>
     <no_of_users>...</no_of_users>
     <integration_capabilities>
        <connections>...</connections>
        <on_premise_connection>...</on_premise_connection>
        <stages>...</stages>
        <production_execution_unit>...</production_execution_unit>
     </integration_capabilities>
  </promoCode>

</platform> </syntaxhighlight>

Response
<syntaxhighlight lang="xml" enclose="div">

<platform>

  <message>
     0
     <description>Success</description>
     <id>...</id>   
  </message>

</platform> </syntaxhighlight>

See also: REST API:Error Codes

Update a promoCode Record

Method
PUT
URI
https://{domain}/networking/rest/promoCode/{promotionCode}
Request
<syntaxhighlight lang="xml" enclose="div">

<platform>

  <promoCode>
     ...
     <name>...</name>
     <start_date>...</start_date>
     <expiration_date>...</expiration_date>
     <trial_days>...</trial_days>
     <no_of_users>...</no_of_users>
     <integration_capabilities>
        <connections>...</connections>
        <on_premise_connection>...</on_premise_connection>
        <stages>...</stages>
        <production_execution_unit>...</production_execution_unit>
     </integration_capabilities>
  </promoCode>

</platform> </syntaxhighlight>

Response
<syntaxhighlight lang="xml" enclose="div">

<platform>

  <message>
     0
     <description>Success</description>
  </message>

</platform> </syntaxhighlight>

See also: REST API:Error Codes

Delete a promoCode Record

Method
DELETE
URI
https://{domain}/networking/rest/promoCode/{promotionCode}
Response
<syntaxhighlight lang="xml" enclose="div">

<platform>

  <message>
     0
     <description>Success</description>
  </message>

</platform> </syntaxhighlight>

See also: REST API:Error Codes

Dynamic Search for promoCode Records

Method
GET
URI
https://{domain}/networking/rest/promoCode?{query_parameters}
Query Parameters
  • fieldList - A comma-separated list of field names to retrieve
  • The asterisk (*) wildcard specifies all fields
  • {fieldname} specifies an individual field (e.g. name)
(Use the REST API:field Resource to get a complete list of fields.)
  • For a Composite Object, specify {alias}.{fieldname} to select a related-record field, where the alias is defined in the Object Relationships.
  • For a Database View, specify {alias}.{fieldname}, where the object alias is defined in the Database View.
  • alias.* specifies all fields in the aliased object.
  • filter - Filtering criteria to filter the records
  • pageSize - Number of records to retrieve from the result set in order to make a "page".
  • page - Number of the logical page in a database result set. The first page is page "zero" (0).
Page zero is returned by default, so appending &pageSize=1 to your query returns a single record.
  • getTotalRecordCount returns the number of total records.
    Causes the following structure to be returned, where N is the total number of records:
<syntaxhighlight lang="xml" enclose="div">

<platform>

  <status>
  <packageDeploy>
  ...
  </packageDeploy>
  </status>
  <message>
     0
     <description>Success</description>
  </message>
  <totalRecordCount>N</totalRecordCount> 

</platform> </syntaxhighlight>

  • sortBy - Field name for primary sort
    Ex: &sortBy=name
  • sortOrder - Sort order of the primary field, either asc or desc (ascending or descending)
    Ex: &sortOrder=desc
  • sortBy2 - Field name for secondary sort
  • sortOrder2 - Sort order of the second field, either asc or desc (ascending or descending)
For more information, see: Specifying Query Parameters in REST APIs
Response
<syntaxhighlight lang="xml" enclose="div">

<platform>

  <promoCode>
  </promoCode>
   ...
  <message>
     0  <!- The number of records returned -->
     <description>Success</description>
  </message>

</platform> </syntaxhighlight>

See also: REST API:Error Codes

Fields

Note: Unless otherwise indicated, the attribute for a field is "Editable on Add or Update".
Name Type Attribute Required on Add Description Additional Information
code String Writable on Add only Checkmark.gif Code the user enters for the promotion
name String Name of the promotion
start_date String Date the promotion starts
end_date String Date the promotion ends
trial_days String Number of days in the trial period
no_of_users String Number of users allowed in the tenant
integration_capabilities struct structure (see below)
id String Read Only Record ID
date_modified Date Read Only UTC Format
date_created Date Read Only UTC Format
created_id Lookup Read Only User ID
modified_id Lookup Read Only User ID
integration_capabilities
Name Type Description
connections String These elements do not apply to the AgileApps Cloud platform. They apply to Integration Live. For more information, consult the relevant documentation.
on_premise_connection String
stages String
production_execution_unit String

Error Codes

Platform Code with Http Status Description
-7000 BAD_REQUEST (400) Invalid ID

Learn more: