Create a Transactable

Last edit: 

Contributors: 

To create a transactable send a POST request to /api/user/transactables

HTTP request

POST /api/user/transactables

Parameters

Parameter Type Description Required Notes
form_configuration_name String Name of the form configuration Required underscored
form TransactableForm TransactableForm parameters that corresponds with FormConfiguration configuration Required
parent_resource_id ID (Int or String) Id or name of definced TransactableType Required name should be underscored

Transactable Parameters

Parameter Type Description Required Notes
creator_id ID User that created transactable Required In html format it is taken from current_user
custom_addresses Hash[String=>CustomAddressForm] Custom addresses for this resource Optional
custom_attachments Hash[String=>CustomAttachmentForm] Custom attachments for this resource, such as pdf, doc Optional
custom_images Hash[String=>CustomImageForm] Custom images for this resource Optional
customizations Hash[String=>CustomizationForm] Customizations for this resource Optional
name String Name of the transactable Optional Will be used to generate slug
properties Hash[String=>Any] Custom properties Optional
transactable_type_id ID TransactableType to which this Transactable belongs Optional

Example request

"authorization: Token token=[YOUR API TOKEN]"
"accept: application/json"
"content-type: application/json"

{
  "form_configuration_name": "reference_rest_api_create_transactable",
  "parent_resource_id": "boat",
  "form": {
    "name": "Boat"
    "creator_id": 1
  }
}
Element Type Description Required?
form_configuration_name String Name of the defined FormConfiguration Required
form TransactableForm Attributes for user, should match configuration defined in corresponding FormConfiguration Required

Example response

HTTP/1.1 201 Created
Content-Type: application/vnd.api+json

{
  "id": 1,
  "errors": {}
}

Element Type Description
id Integer Object identifier
errors Object Validation errors

Error and Status Codes

Code Message Meaning
201 Created Resource was created
401 Unathorized Invalid Authentication
406 Not Acceptable Wrong parameters passed
422 Unprocessable Entity Wrong values, not matched validations