POST campaigns/:campaign id/registrations
(moved POST campaigns/:campaign id/registrations to POST campaigns/:campaign id/registrations PT-BR) |
|||
Line 1: | Line 1: | ||
− | + | == Description == | |
+ | |||
+ | Creates a new registration in the Social Login Webform, according to the custom field definition configured in the platform. | ||
+ | |||
+ | Para construir o campo "fields" a ser informado nesta API, use o "Nome no Banco de Dados" informado ao configurar o campo no Webform. Se os campos informados em "fields" não seguirem as especificações configuradas, um erro de validação (status 422) ou de forbidden (403) será retornado. Exemplo: | ||
+ | * foi adicionado um novo campo em "fields" que não foi configurado na plataforma. | ||
+ | * um campo obrigatório não foi informado. | ||
+ | * houve algum erro de validação de acordo com o tipo do campo. | ||
+ | |||
+ | Não é necessário informar todos os campos configurados na plataforma em "fields", pois eles podem ser opcionais e também auto-preenchidos pelas redes sociais ou por cadastros anteriores (o nome no banco de dados mantém um histórico de preenchimentos), de acordo com a configuração feita. Se você quer ter certeza que o campo não será auto-preenchido, informe-o no campo "fields" com seu respectivo valor. | ||
+ | |||
+ | == Resource URL == | ||
+ | |||
+ | POST https://api.socialidnow.com/v1/marketing/campaigns/:campaign_id/registrations | ||
+ | |||
+ | == Parameters == | ||
+ | |||
+ | === URL Parameters === | ||
+ | |||
+ | {| | ||
+ | ! align="left" width="200px" | campaign_id | ||
+ | | width="200px" | required | ||
+ | | webform identifier. | ||
+ | |} | ||
+ | |||
+ | === JSON Parameters === | ||
+ | |||
+ | {| | ||
+ | ! align="left" width="200px" | user_id ou connection_id | ||
+ | | width="200px" | required | ||
+ | | user identifier in the Social Login platform, either by its user_id or by an active connection (connection_id). | ||
+ | |- | ||
+ | ! align="left" width="200px" | fields | ||
+ | | width="200px" | required | ||
+ | | a hash in the format field:value, according to the fields configures in the platform. | ||
+ | |} | ||
+ | |||
+ | == Authentication == | ||
+ | |||
+ | This API requires Marketing Account authentication. See [[Authentication]]. | ||
+ | |||
+ | == Response == | ||
+ | |||
+ | === Response Status === | ||
+ | |||
+ | {| | ||
+ | ! align="left" width="200px" | created (201) | ||
+ | | The registration was created successfully. | ||
+ | |- | ||
+ | ! align="left" width="200px" | unauthorized (401) | ||
+ | | The authentication is wrong. See [[Authentication]]. | ||
+ | |- | ||
+ | ! align="left" width="200px" | forbidden (403) | ||
+ | | An error happened in the field "fields". Either the informed user_id does not belong to the Social Login App associated with the webform, or the campaign_id does not belong to the Marketing Account. | ||
+ | |- | ||
+ | ! align="left" width="200px" | not_found (404) | ||
+ | | The connection_id was not found. | ||
+ | |- | ||
+ | ! align="left" width="200px" | conflict (409) | ||
+ | | The registration wasn't accepted due to an existing registration for the given user. This error may occur in webforms configured to receive at most one registration per user. | ||
+ | |- | ||
+ | ! align="left" width="200px" | unprocessable_entity (422) | ||
+ | | Validation error in the field "fields". | ||
+ | |- | ||
+ | ! align="left" width="200px" | internal_server_error (500) | ||
+ | | An unknown error happened. | ||
+ | |} | ||
+ | |||
+ | == Examples == | ||
+ | |||
+ | === Request === | ||
+ | |||
+ | Creates a new registration in the webform "284" for the user "23". | ||
+ | |||
+ | curl -iX POST 'https://api.socialidnow.com/v1/marketing/campaigns/284/registrations' \ | ||
+ | -d '{"user_id":"23", "fields": {"endereco": "Rua Joao Vitor, 332", "complemento": "Apto 341", "cpf": "1234567890"}}' \ | ||
+ | -H 'Content-type:application/json' \ | ||
+ | --user 14:a8c8604cdf390db4fce83b7f683b422b97c0ab5ced88f9b303b69ff467a77314 | ||
+ | |||
+ | === Response === | ||
+ | |||
+ | ==== Response Headers ==== | ||
+ | |||
+ | HTTP/1.1 201 Created | ||
+ | Status: 201 |
Revision as of 21:59, 3 November 2014
Contents |
Description
Creates a new registration in the Social Login Webform, according to the custom field definition configured in the platform.
Para construir o campo "fields" a ser informado nesta API, use o "Nome no Banco de Dados" informado ao configurar o campo no Webform. Se os campos informados em "fields" não seguirem as especificações configuradas, um erro de validação (status 422) ou de forbidden (403) será retornado. Exemplo:
- foi adicionado um novo campo em "fields" que não foi configurado na plataforma.
- um campo obrigatório não foi informado.
- houve algum erro de validação de acordo com o tipo do campo.
Não é necessário informar todos os campos configurados na plataforma em "fields", pois eles podem ser opcionais e também auto-preenchidos pelas redes sociais ou por cadastros anteriores (o nome no banco de dados mantém um histórico de preenchimentos), de acordo com a configuração feita. Se você quer ter certeza que o campo não será auto-preenchido, informe-o no campo "fields" com seu respectivo valor.
Resource URL
POST https://api.socialidnow.com/v1/marketing/campaigns/:campaign_id/registrations
Parameters
URL Parameters
campaign_id | required | webform identifier. |
---|
JSON Parameters
user_id ou connection_id | required | user identifier in the Social Login platform, either by its user_id or by an active connection (connection_id). |
---|---|---|
fields | required | a hash in the format field:value, according to the fields configures in the platform. |
Authentication
This API requires Marketing Account authentication. See Authentication.
Response
Response Status
created (201) | The registration was created successfully. |
---|---|
unauthorized (401) | The authentication is wrong. See Authentication. |
forbidden (403) | An error happened in the field "fields". Either the informed user_id does not belong to the Social Login App associated with the webform, or the campaign_id does not belong to the Marketing Account. |
not_found (404) | The connection_id was not found. |
conflict (409) | The registration wasn't accepted due to an existing registration for the given user. This error may occur in webforms configured to receive at most one registration per user. |
unprocessable_entity (422) | Validation error in the field "fields". |
internal_server_error (500) | An unknown error happened. |
Examples
Request
Creates a new registration in the webform "284" for the user "23".
curl -iX POST 'https://api.socialidnow.com/v1/marketing/campaigns/284/registrations' \ -d '{"user_id":"23", "fields": {"endereco": "Rua Joao Vitor, 332", "complemento": "Apto 341", "cpf": "1234567890"}}' \ -H 'Content-type:application/json' \ --user 14:a8c8604cdf390db4fce83b7f683b422b97c0ab5ced88f9b303b69ff467a77314
Response
Response Headers
HTTP/1.1 201 Created Status: 201