You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@kafka.apache.org by Clint Mcneil <cl...@gmail.com> on 2015/03/31 10:51:21 UTC

schemaregistry example

Hi guys

When trying the example schema in
http://confluent.io/docs/current/schema-registry/docs/api.html

POST /subjects/test HTTP/1.1Host: schemaregistry.example.comAccept:
application/vnd.schemaregistry.v1+json,
application/vnd.schemaregistry+json, application/json
{
      "schema":
         "{                \"type\": \"record\",
\"name\": \"test\",                \"fields\":                  [
              {                      \"type\": \"string\",
         \"name\": \"field1\"                    },
{                      \"type\": \"integer\",
\"name\": \"field2\"                    }                  ]
   }"
    }

I get the following error...

IR-52:confluent-1.0 clint$ curl -X POST -i -H "Content-Type:
application/vnd.schemaregistry.v1+json" \
> --data '{"schema": "{ \"type\": \"record\", \"name\": \"test\", \"fields\": [{ \"type\": \"string\", \"name\": \"field1\" }, { \"type\": \"integer\", \"name\": \"field2\" }]}"}' \
> http://localhost:8081/subjects/Clint1-key/versions
HTTP/1.1 422
Content-Length: 71
Content-Type: application/vnd.schemaregistry.v1+json
Server: Jetty(8.1.16.v20140903)

{"error_code":42201,"message":"Input schema is an invalid Avro
schema"}IR-52:confluent-1.0 clint$

Please advise

Thanks

Re: schemaregistry example

Posted by Ewen Cheslack-Postava <ew...@confluent.io>.
The name for the int type in Avro is "int" not "integer". Your command
should work if you change field2's type.

-Ewen

On Tue, Mar 31, 2015 at 1:51 AM, Clint Mcneil <cl...@gmail.com> wrote:

> Hi guys
>
> When trying the example schema in
> http://confluent.io/docs/current/schema-registry/docs/api.html
>
> POST /subjects/test HTTP/1.1Host: schemaregistry.example.comAccept:
> application/vnd.schemaregistry.v1+json,
> application/vnd.schemaregistry+json, application/json
> {
>       "schema":
>          "{                \"type\": \"record\",
> \"name\": \"test\",                \"fields\":                  [
>               {                      \"type\": \"string\",
>          \"name\": \"field1\"                    },
> {                      \"type\": \"integer\",
> \"name\": \"field2\"                    }                  ]
>    }"
>     }
>
> I get the following error...
>
> IR-52:confluent-1.0 clint$ curl -X POST -i -H "Content-Type:
> application/vnd.schemaregistry.v1+json" \
> > --data '{"schema": "{ \"type\": \"record\", \"name\": \"test\",
> \"fields\": [{ \"type\": \"string\", \"name\": \"field1\" }, { \"type\":
> \"integer\", \"name\": \"field2\" }]}"}' \
> > http://localhost:8081/subjects/Clint1-key/versions
> HTTP/1.1 422
> Content-Length: 71
> Content-Type: application/vnd.schemaregistry.v1+json
> Server: Jetty(8.1.16.v20140903)
>
> {"error_code":42201,"message":"Input schema is an invalid Avro
> schema"}IR-52:confluent-1.0 clint$
>
> Please advise
>
> Thanks
>



-- 
Thanks,
Ewen