add_product
This allows you to add products to your applicants by sending over an array of product IDs. The products must already be created within the product editing page before adding them. Private products can be created "on the spot" if desired, but this is less recommended.
Name | Type | Required | Description |
---|---|---|---|
action | string | true | add_product |
group_id | numeric | true | This designates which project the action should be applied towards. |
clogin_id | numeric | false | This is a central login ID that identifies a user within your organization. Organizations can have multiple projects that the same user can register in. If you know the clogin_id from a separate project, you can use it to connect the accounts. clogin_id should be false for a user who is being created for the first time within your organization. |
product_list | object | true | JSON that provides p_id, q, and other optional arguments. See below for more. |
See the products section for more information on the product types.
Name | Product Type | Variable Type | Required | Description |
---|---|---|---|---|
p_id | all, except private products | integer | true | p_id for the product you'd like to add can be found on the product management page by editing the product properties and looking under the product information tab. If creating a private product, name is required instead (since private products have no pre-existing p_id ). |
q | all | integer | true | The quantity of the product you'd like to add. Note that the system will only add a single product if you set q>1 and "Product can only be ordered once" is turned on in the product editing page. |
product_remark | all | string | false | This is a remark you can add to the applicant's cart about this product. You can use this for personalized information. |
recurring_start_date | recurring | string | false | This allows you to set when a recurring product started if you'd like it not to be the current date. The default format is "mm-dd-yyyy", but you can set the structure with date_structure. |
date_structure | recurring | string | false | Allows you to choose between "yyyy-mm-dd", "dd-mm-yyyy", or the default "mm-dd-yyyy". |
name | private | string | true* | The name of the private product |
price | private | numeric | true* | The price of the private product |
sessions | session | array | false | An array of session IDs that you would like to add. The session IDs can be accessed on the product editing page. Adds all sessions by default. |
selected_days | session | array | false | This allows you to specify which days within a session you would like to add by passing an array of dates for each session. The dates are supplied in mySQL format. See the partial session sample below for more on how to structure this call. Note that any restrictions placed on the sessions themselves will overide any calls through the API. For instance if you supply an amount of days less than the minimum required partial selection, then the system will not add the sessions. |
*true only for private products.
Similar to update, there are a number of behind-the-scenes validation actions that are occurring whenever you attempt to add a product via the API.
There are three common scenarios in which an add_product call will be made, but no product will be added for the user.
- If you attempt to add a product to a user which does not exist in the project, the system will not add the product.
- If you attempt to add a product to a user who does exist, however p_id does not exist in the project, then the system will not add any product (excepting private products).
- Finally, if you attempt to add a product to a user who does exist, however the request does not conform to the product's selection requirements, then the system will not add any product. For instance if you attempt to add a product who's quota has already been filled, or which is not yet available or expired, then the system will prevent the API action.