AgileApps Support Wiki Pre Release

Difference between revisions of "REST API:promoCode Resource"

From AgileApps Support Wiki
imported>Aeric
imported>Aeric
Line 12: Line 12:
{{ISV Configuration}}
{{ISV Configuration}}


===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>
         <id>...</id>
         <field>data</field>
         <field>data</field>
         ...
         ...
     </__resourceName__>
     </promoCode>


     <message>
     <message>
Line 43: Line 35:
: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>
         <field>data</field>
         ...
         ...
     </__resourceName__>
     </promoCode>
</platform>
</platform>
</syntaxhighlight>
</syntaxhighlight>
Line 65: Line 57:
         <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 promoCode -->
     </message>
     </message>
</platform>
</platform>
Line 72: Line 64:
: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>
         <id>{promotionCode}</id>
         ...
         ...
     </__resourceName__>
     </promoCode>
</platform>
</platform>
</syntaxhighlight>
</syntaxhighlight>
Line 99: Line 91:
: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:
Line 117: Line 109:
: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 221: Line 213:
<noinclude>
<noinclude>


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

Revision as of 00:11, 10 January 2015

Manage Promotion Codes using the REST API.

Learn more: REST API Conventions and Considerations.

Notepad.png

Note: Use this structure the same way you use the structure for man pages:
Follow the presentation pattern, but if a section isn't needed, don't include the header.
Also:

  1. Add an entry to the REST API CheatSheet
  2. Add an entry to the REST API (categorized) page
  3. Add an entry to the REST Resources page

Permissions

Lock-tiny.gif

Get a promoCode Record

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

<platform>

   <promoCode>
       <id>...</id>
       <field>data</field>
        ...
   </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>
       <field>data</field>
        ...
   </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>
       <id>{promotionCode}</id>
        ...
   </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>

   ....
   <message>
       0
       <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
id String Read Only Record Id
name String Checkmark.gif
description String
... ... ... ... ... ...
item String Read Only description AddlInfo
item String description AddlInfo
item String Checkmark.gif description AddlInfo
item String Writable on Add only Checkmark.gif description AddlInfo
subItem Tag Checkmark.gif description AddlInfo
... ... ... ... ... ...
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

-or-

Name Type Attribute Default Value Description Additional Information
item String Read Only Default description AddlInfo
item String Default description AddlInfo
subItem Tag description AddlInfo
... ... ... ... ... ...
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
subItem Tag
Name Type Attribute Required on Add Description Additional Information
field String descr addl info

Error Codes

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

Learn more: