Creatio (creatio v0.3.1)
Copy MarkdownElixir SDK for Creatio CRM (formerly bpm'online).
Provides an idiomatic, comprehensive client for interacting with Creatio instances via OData 4, OData 3, DataService JSON APIs, Forms Authentication, and OAuth 2.0.
Quick Start
Forms Authentication
client = Creatio.new(base_url: "https://myinstance.creatio.com")
{:ok, client} = Creatio.login(client, "User01", "Password123")
# List contacts
{:ok, contacts} = Creatio.list(client, "Contact", select: ["Id", "Name", "Email"], top: 10)OAuth 2.0 Client Credentials
client = Creatio.new(
base_url: "https://myinstance.creatio.com",
identity_service_url: "https://myidentity.creatio.com",
client_id: "your_client_id",
client_secret: "your_client_secret"
)
{:ok, client, _token} = Creatio.login_oauth(client)OData 4 Query Builder
{:ok, results} =
Creatio.query("Contact")
|> Creatio.OData.Query.select(["Id", "Name", "MobilePhone"])
|> Creatio.OData.Query.filter_contains("Name", "Smith")
|> Creatio.OData.Query.filter_eq("Active", true)
|> Creatio.OData.Query.order_by("CreatedOn desc")
|> Creatio.OData.Query.top(20)
|> Creatio.list(client)Streaming / Auto-pagination
# Seamlessly iterates over pages of records using $top and $skip,
# with optional initial :skip offset for resuming syncs
Creatio.stream(client, "Contact", page_size: 100, skip: 500, select: ["Id", "Name"])
|> Enum.take(250)Read-Only Safety Mode
# Protect production CRM data by enforcing client-side read-only mode
client = Creatio.new(base_url: "https://myinstance.creatio.com", read_only: true)
# Queries succeed normally:
{:ok, contacts} = Creatio.list(client, "Contact")
# All mutation attempts are blocked locally with status 403 / "ReadOnlyMode":
{:error, %Creatio.Error{code: "ReadOnlyMode"}} = Creatio.create(client, "Contact", %{"Name" => "Jane"})Batch Operations
batch =
Creatio.batch_new(continue_on_error: true)
|> Creatio.Batch.add_create("Contact", %{"Name" => "John Doe"})
|> Creatio.Batch.add_update("Contact", "some-uuid", %{"JobTitle" => "Director"})
{:ok, responses} = Creatio.batch(client, batch)
Summary
Functions
Executes an OData batch request (POST /0/odata/$batch).
Same as batch/3, raising Creatio.Error on failure.
Initializes a new Creatio.Batch request.
Parses a multipart/mixed batch response body.
Executes a BatchQuery against /0/DataService/json/SyncReply/BatchQuery.
Same as batch_query/3, raising Creatio.Error on failure.
Serializes a batch to a multipart/mixed MIME body string. Returns {boundary, body}.
Gets total count of an entity collection (GET /0/odata/{Entity}/$count).
Same as count/3, raising Creatio.Error on failure.
Creates an entity record (POST /0/odata/{Entity}).
Same as create/4, raising Creatio.Error on failure.
Calls a custom Creatio REST web service (/0/rest/{service_name}/{endpoint}).
Same as custom_service/5, raising Creatio.Error on failure.
Executes a generic DataService query against /0/DataService/json/SyncReply/{action}.
Same as data_service_query/4, raising Creatio.Error on failure.
Deletes an entity record (DELETE /0/odata/{Entity}({id})).
Same as delete/4, raising Creatio.Error on failure.
Deletes a specific field value (DELETE /0/odata/{Entity}({id})/{Field}).
Same as delete_field/5, raising Creatio.Error on failure.
Executes a DeleteQuery against /0/DataService/json/SyncReply/DeleteQuery.
Same as delete_query/3, raising Creatio.Error on failure.
Executes an OData query or entity listing. Alias for list/3.
Same as execute/3, raising Creatio.Error on failure.
Builds a Creatio.Client from an existing Req.Request.
Retrieves a single entity by its primary ID (GET /0/odata/{Entity}({id})).
Same as get/4, raising Creatio.Error on failure.
Retrieves a specific field value by ID (GET /0/odata/{Entity}({id})/{Field}).
Same as get_field/5, raising Creatio.Error on failure.
Retrieves raw scalar/stream value (GET /0/odata/{Entity}({id})/{Field}/$value).
Same as get_field_value/4, raising Creatio.Error on failure.
Retrieves related records via a navigation property (GET /0/odata/{Entity}({id})/{Property}).
Same as get_navigation/5, raising Creatio.Error on failure.
Executes an InsertQuery against /0/DataService/json/SyncReply/InsertQuery.
Same as insert_query/3, raising Creatio.Error on failure.
Queries an entity collection (GET /0/odata/{Entity}).
Same as list/3, raising Creatio.Error on failure.
Authenticates via Forms authentication using username and password.
Authenticates via OAuth 2.0 client credentials against the Identity Service.
Builds a new Creatio.Client.
Checks OAuth health endpoint (/0/api/OAuthHealthCheck).
Gets total count of an entity collection in OData 3.
Same as odata3_count/3, raising Creatio.Error on failure.
Creates an entity via legacy OData 3.
Same as odata3_create/4, raising Creatio.Error on failure.
Deletes an entity via legacy OData 3.
Same as odata3_delete/4, raising Creatio.Error on failure.
Retrieves an entity by ID via legacy OData 3.
Same as odata3_get/4, raising Creatio.Error on failure.
Retrieves a field value of an entity in OData 3.
Same as odata3_get_field/5, raising Creatio.Error on failure.
Retrieves raw scalar/stream value in OData 3.
Same as odata3_get_field_value/4, raising Creatio.Error on failure.
Retrieves related records via a navigation property in OData 3.
Same as odata3_get_navigation/5, raising Creatio.Error on failure.
Queries an entity collection via legacy OData 3 (/0/ServiceModel/EntityDataService.svc/).
Same as odata3_list/3, raising Creatio.Error on failure.
Returns a lazy Stream that paginates through records of a legacy OData 3 entity collection.
Updates an entity via legacy OData 3.
Same as odata3_update/5, raising Creatio.Error on failure.
Retrieves OpenID configuration (/.well-known/openid-configuration).
Initializes a new Creatio.OData.Query builder.
Executes a SelectQuery against /0/DataService/json/SyncReply/SelectQuery.
Same as select_query/3, raising Creatio.Error on failure.
Returns a lazy Stream that paginates through records of an entity or query.
Updates an entity record (PATCH /0/odata/{Entity}({id})).
Same as update/5, raising Creatio.Error on failure.
Updates a field or octet-stream binary (PUT /0/odata/{Entity}({id})/{Field}).
Same as update_field/6, raising Creatio.Error on failure.
Executes an UpdateQuery against /0/DataService/json/SyncReply/UpdateQuery.
Same as update_query/3, raising Creatio.Error on failure.
Functions
Executes an OData batch request (POST /0/odata/$batch).
Same as batch/3, raising Creatio.Error on failure.
Initializes a new Creatio.Batch request.
Parses a multipart/mixed batch response body.
Executes a BatchQuery against /0/DataService/json/SyncReply/BatchQuery.
Same as batch_query/3, raising Creatio.Error on failure.
Serializes a batch to a multipart/mixed MIME body string. Returns {boundary, body}.
Gets total count of an entity collection (GET /0/odata/{Entity}/$count).
Same as count/3, raising Creatio.Error on failure.
Creates an entity record (POST /0/odata/{Entity}).
Same as create/4, raising Creatio.Error on failure.
Calls a custom Creatio REST web service (/0/rest/{service_name}/{endpoint}).
Same as custom_service/5, raising Creatio.Error on failure.
Executes a generic DataService query against /0/DataService/json/SyncReply/{action}.
Same as data_service_query/4, raising Creatio.Error on failure.
Deletes an entity record (DELETE /0/odata/{Entity}({id})).
Same as delete/4, raising Creatio.Error on failure.
Deletes a specific field value (DELETE /0/odata/{Entity}({id})/{Field}).
Same as delete_field/5, raising Creatio.Error on failure.
Executes a DeleteQuery against /0/DataService/json/SyncReply/DeleteQuery.
Same as delete_query/3, raising Creatio.Error on failure.
Executes an OData query or entity listing. Alias for list/3.
Same as execute/3, raising Creatio.Error on failure.
Builds a Creatio.Client from an existing Req.Request.
Retrieves a single entity by its primary ID (GET /0/odata/{Entity}({id})).
Same as get/4, raising Creatio.Error on failure.
Retrieves a specific field value by ID (GET /0/odata/{Entity}({id})/{Field}).
Same as get_field/5, raising Creatio.Error on failure.
Retrieves raw scalar/stream value (GET /0/odata/{Entity}({id})/{Field}/$value).
Same as get_field_value/4, raising Creatio.Error on failure.
Executes an InsertQuery against /0/DataService/json/SyncReply/InsertQuery.
Same as insert_query/3, raising Creatio.Error on failure.
Queries an entity collection (GET /0/odata/{Entity}).
Same as list/3, raising Creatio.Error on failure.
Authenticates via Forms authentication using username and password.
Authenticates via OAuth 2.0 client credentials against the Identity Service.
Builds a new Creatio.Client.
Options
:base_url- The base URL of the Creatio instance (e.g."https://myinstance.creatio.com").:auth_token- OAuth 2.0 Bearer access token.:cookie- Cookie string for Forms authentication.:bpmcsrf- CSRF token string for Forms authentication.:identity_service_url- Base URL for Creatio Identity Service.:client_id- OAuth 2.0 client ID.:client_secret- OAuth 2.0 client secret.:read_only- Iftrue, enables defense-in-depth read-only mode to prevent mutation requests (defaults tofalse, orApplication.get_env(:creatio, :read_only), orCREATIO_READ_ONLYenv var).:req_options- Extra options passed directly toReq.new/1.
Checks OAuth health endpoint (/0/api/OAuthHealthCheck).
Gets total count of an entity collection in OData 3.
Same as odata3_count/3, raising Creatio.Error on failure.
Creates an entity via legacy OData 3.
Same as odata3_create/4, raising Creatio.Error on failure.
Deletes an entity via legacy OData 3.
Same as odata3_delete/4, raising Creatio.Error on failure.
Retrieves an entity by ID via legacy OData 3.
Same as odata3_get/4, raising Creatio.Error on failure.
Retrieves a field value of an entity in OData 3.
Same as odata3_get_field/5, raising Creatio.Error on failure.
Retrieves raw scalar/stream value in OData 3.
Same as odata3_get_field_value/4, raising Creatio.Error on failure.
Queries an entity collection via legacy OData 3 (/0/ServiceModel/EntityDataService.svc/).
Same as odata3_list/3, raising Creatio.Error on failure.
Returns a lazy Stream that paginates through records of a legacy OData 3 entity collection.
Options
:page_size- Records per request (default: 100).:skip- Initial offset to begin streaming from (default: 0).:select- List or string of fields to retrieve.:filter- Filter expression.:orderby- Ordering expression.:expand- Relations to expand.
Same as odata3_stream/3.
Updates an entity via legacy OData 3.
Same as odata3_update/5, raising Creatio.Error on failure.
Retrieves OpenID configuration (/.well-known/openid-configuration).
Initializes a new Creatio.OData.Query builder.
Executes a SelectQuery against /0/DataService/json/SyncReply/SelectQuery.
Same as select_query/3, raising Creatio.Error on failure.
Returns a lazy Stream that paginates through records of an entity or query.
Options
:page_size- Number of records per request (default: 100).:skip- Initial offset to begin streaming from (default: 0).:select- List of fields or comma-separated string to retrieve.:filter- OData filter expression string.:orderby- Ordering expression string.:expand- Relations to expand.
Updates an entity record (PATCH /0/odata/{Entity}({id})).
Same as update/5, raising Creatio.Error on failure.
Updates a field or octet-stream binary (PUT /0/odata/{Entity}({id})/{Field}).
Same as update_field/6, raising Creatio.Error on failure.
Executes an UpdateQuery against /0/DataService/json/SyncReply/UpdateQuery.
Same as update_query/3, raising Creatio.Error on failure.