POST datastore/schemas
(Difference between revisions)
Line 1: | Line 1: | ||
− | # | + | == Description == |
+ | |||
+ | Cria um novo Schema. | ||
+ | |||
+ | == Resource URL == | ||
+ | |||
+ | POST https://api.socialidnow.com/v1/marketing/datastore/schemas | ||
+ | |||
+ | == Parameters == | ||
+ | |||
+ | {| | ||
+ | ! align="left" width="200px" | schema | ||
+ | | width="200px" | obrigatório | ||
+ | | um hash no formato campo:valor, contendo os campos necessários para criação do schema: | ||
+ | |- | ||
+ | ! align="left" width="200px" style="padding-left: 20px" | name | ||
+ | | width="200px" | obrigatório | ||
+ | | nome do schema | ||
+ | |- | ||
+ | ! align="left" width="200px" style="padding-left: 20px" | fields | ||
+ | | width="200px" | opcional | ||
+ | | um array de hashes no formato campo:valor, contendo os campos necessários para criação dos fields: | ||
+ | |- | ||
+ | ! align="left" width="200px" style="padding-left: 40px" | name | ||
+ | | width="200px" | obrigatório | ||
+ | | nome do field | ||
+ | |- | ||
+ | ! align="left" width="200px" style="padding-left: 40px" | type | ||
+ | | width="200px" | obrigatório | ||
+ | | tipo do field (array, boolean, date, datetime, float, hash, integer, string, time) | ||
+ | |} | ||
+ | |||
+ | == Authentication == | ||
+ | |||
+ | Esta API exige autenticação do Marketing Account. Ver [[#Authentication|Autenticação]]. | ||
+ | |||
+ | == Response == | ||
+ | |||
+ | ==== Response Status ==== | ||
+ | {| | ||
+ | ! align="left" width="200px" | created (201) | ||
+ | | O schema foi criado com sucesso. | ||
+ | |+ | ||
+ | ! align="left" width="200px" | bad_request (400) | ||
+ | | Algum parâmetro obrigatório não foi informado. | ||
+ | |+ | ||
+ | ! align="left" width="200px" | unauthorized (401) | ||
+ | | A autenticação está errada. Ver [[#Authentication|Autenticação]]. | ||
+ | |+ | ||
+ | ! align="left" width="200px" | unprocessable_entity (422) | ||
+ | | Erro de validação no campo "schema". | ||
+ | |+ | ||
+ | ! align="left" width="200px" | internal_server_error (500) | ||
+ | | Um erro desconhecido ocorreu. | ||
+ | |} | ||
+ | |||
+ | == Example Request == | ||
+ | |||
+ | Cria um novo schema com nome "first_schema" e dois fields, um chamado "first_field" do tipo "string" e outro chamado "second_field" do tipo "integer". | ||
+ | |||
+ | curl -iX POST 'https://api.socialidnow.com/v1/marketing/datastore/schemas' \ | ||
+ | -d '{ | ||
+ | "schema": { | ||
+ | "name":"first_schema", | ||
+ | "fields":[ | ||
+ | { "name":"first_field", "type":"string" }, | ||
+ | { "name":"second_field", "type":"integer" } | ||
+ | ] | ||
+ | } | ||
+ | }' \ | ||
+ | -H 'Content-type: application/json' \ | ||
+ | --user 138:e8b9ca24f1b590af67e6271297d6e1f7226625d61c5b5daa1b2f215464e292cf | ||
+ | |||
+ | Response: | ||
+ | |||
+ | HTTP/1.1 201 Created | ||
+ | Location: 'https://api.socialidnow.com/v1/marketing/datastore/schemas/first_schema' | ||
+ | Status: 201 |
Revision as of 12:59, 3 November 2014
Contents |
Description
Cria um novo Schema.
Resource URL
POST https://api.socialidnow.com/v1/marketing/datastore/schemas
Parameters
schema | obrigatório | um hash no formato campo:valor, contendo os campos necessários para criação do schema: |
---|---|---|
name | obrigatório | nome do schema |
fields | opcional | um array de hashes no formato campo:valor, contendo os campos necessários para criação dos fields: |
name | obrigatório | nome do field |
type | obrigatório | tipo do field (array, boolean, date, datetime, float, hash, integer, string, time) |
Authentication
Esta API exige autenticação do Marketing Account. Ver Autenticação.
Response
Response Status
created (201) | O schema foi criado com sucesso. | bad_request (400) | Algum parâmetro obrigatório não foi informado. | unauthorized (401) | A autenticação está errada. Ver Autenticação. | unprocessable_entity (422) | Erro de validação no campo "schema". | internal_server_error (500) | Um erro desconhecido ocorreu. |
---|
Example Request
Cria um novo schema com nome "first_schema" e dois fields, um chamado "first_field" do tipo "string" e outro chamado "second_field" do tipo "integer".
curl -iX POST 'https://api.socialidnow.com/v1/marketing/datastore/schemas' \ -d '{ "schema": { "name":"first_schema", "fields":[ { "name":"first_field", "type":"string" }, { "name":"second_field", "type":"integer" } ] } }' \ -H 'Content-type: application/json' \ --user 138:e8b9ca24f1b590af67e6271297d6e1f7226625d61c5b5daa1b2f215464e292cf
Response:
HTTP/1.1 201 Created Location: 'https://api.socialidnow.com/v1/marketing/datastore/schemas/first_schema' Status: 201