create_user_agreement¶
- ManagementApi.create_user_agreement(role_id, create_user_agreement_request, content_type=None, _request_timeout=None, _request_auth=None, _content_type=None, _headers=None, _host_index=0)¶
Create a user agreement
Creates a new user agreement. Requires system-settings.fullaccess. The body must include AgreementName, Description, and TermsOfUse and no other keys (IPV-1008). AgreementName must be 3-120 characters, start with a letter, use only letters, digits, and underscores, and be unique case-insensitively (IPV-1004, IPV-1018).TermsOfUse is the markdown file as a base64 string; it is stored and a new Version (unix epoch seconds) is returned. Repeating the same body creates a new version unless the name already exists.
- Parameters:
role_id (str) – Amorphic role ID the request is authorized against. Must be a role the user belongs to. Used for permission checks and audit logs. (required)
create_user_agreement_request (CreateUserAgreementRequest) – (required)
content_type (str) – Media type of the request body. Send application/json.
_request_timeout (int, tuple(int, int), optional) – timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts.
_request_auth (dict, optional) – set to override the auth_settings for an a single request; this effectively ignores the authentication in the spec for a single request.
_content_type (str, Optional) – force content-type for the request.
_headers (dict, optional) – set to override the headers for a single request; this effectively ignores the headers in the spec for a single request.
_host_index (int, optional) – set to override the host_index for a single request; this effectively ignores the host_index in the spec for a single request.
- Return type:
- Returns:
Returns the result object.
Request and Response Examples¶
HTTP: POST /user-agreements
Request¶
Request / response example
{
"AgreementName": "Default_User_Agreement",
"Description": "Default Agreement",
"TermsOfUse": "IyBUZXJtcyBvZiBVc2UK"
}
Success (HTTP 200)¶
Fixed Message plus Version unix-epoch string used as the DynamoDB GSI key and S3 object name.
Created
{
"Message": "Successfully created user agreement.",
"Version": "1548975106"
}
Errors¶
Documented error codes: AUTH-1001, AUTH-1030, IPV-1008, IPV-1001, IPV-1004, IPV-1018, RTE-1001, EMF-1001.
HTTP 400
AUTH-1001 missing role_id. AUTH-1030 missing system-settings.fullaccess. IPV-1008 extra or missing body keys (extra keys reuse the missing-key message). IPV-1001 empty AgreementName or TermsOfUse. IPV-1004 invalid AgreementName. IPV-1018 duplicate AgreementName.
Missing permission
{
"Message": "AUTH-1030 - User is not authorized to create a new user agreement due to the following missing permission(s) - {'system-settings': ['fullaccess']}"
}
Extra body key
{
"Message": "IPV-1008 - Invalid request body, missing key(s) - ExtraKey"
}
Empty TermsOfUse
{
"Message": "IPV-1001 - Parameter TermsOfUse is a required value."
}
Invalid AgreementName
{
"Message": "IPV-1004 - User AgreementName must be 3-120 alphanumeric, underscore characters only."
}
Duplicate AgreementName
{
"Message": "IPV-1018 - Invalid parameter - User Agreement Name, parameter value already exists, use different value."
}
HTTP 500
Uncaught Exception formatted as RTE-1001 via EMF-1001, including invalid base64 TermsOfUse, S3 upload failure, or DynamoDB put failure.
Uncaught Exception
{
"Message": "RTE-1001 - Failed to upload the user agreement file to S3."
}