Reputation: 346
Apologize if it's redundant with the error but I'm looking for a specific solution.
I'm trying to post a new version of schema to Hortonworks Schema Registry using the swagger rest API. I'm using python requests module to programmatically post new versions.
path = '/' + schemaname + '/versions' + '/' + str(max(versions)+1)
logger.info(self.url(path))
requests.post(self.url(path), schemaText)
ERROR [2019-02-15 17:18:13.496] [dw-167124 - PUT /api/v1/schemaregistry/schemas/diff%20data/versions/2] c.h.r.c.GenericExceptionMapper - Got exception: [NotAllowedException] / message [HTTP 405 Method Not Allowed]
I tried the various things as suggested by the previous issues on 'Method allowed exception' like using PUT, POST or GET instead. But none worked. What is the right way to post a new version of schema to hdf registry using the rest api programmatically?
Upvotes: -1
Views: 243
Reputation: 191973
In the source code, it's @POST @Path("/schemas/{name}/versions")
You need to remove the version number at the end, as it returns you a version. You don't give a schema a specific version
And I don't know if spaces are allowed, so you might want to remove it from diff data
The address you are using for @GET @Path("/schemas/{name}/versions/{version}")
does not allow other HTTP methods
Note: You can use swagger-codegen
to create Python code for the server rather than re-write code in requests
Upvotes: 0