This documentation is for WSO2 Governance Registry 5.3.0. View documentation for the latest release.

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Syntax  

POST /governance/<asset_short_name_s> <payload>

Here the payload should be in JSON format. Following are the required attributes.

  • name
  • version
  • type

Payload format is as follows:

Code Block
{ name: "Artifact Name", type: "Artifact Type", version: “Version Number", Attribute-N: “Attribute-N” value } 
Example
Code Block
languagejava
POST https://localhost:9443 /governance/restservices { name: "TestRESTService", type: "restservice", context: "/test", version: "1.0.0" }
Sample cURL Command
Code Block
languagejava
curl -X POST -H "Authorization: Basic YWRtaW46YWRtaW4=" -H "Content-Type: application/json" -H "Cache-Control: no-cache" -d '{
  "name":"TestRESTService",
  "type":"restservice",
  "context":"/test",
  "version":"1.0.0"
}' "https://localhost:9443/governance/restservices" -i -k
Response

If the artifact creation is successful, the server will return HTTP 200 code along with the “location” header pointing to the newly created artifact. If there is an issue creating a new artifact, it will return an appropriate error code.  

For example, the above example may return the following:

HTTP 200

Location: https://localhost:9443/governance/restservices/3ec1dcd9-66d8-41da-a0d2-ec171df64cc3

Create a new asset with an unbounded table

...

POST /governance/<asset_short_name_s> <payload>

Here the payload should be in JSON format. Following are the required attributes.

  • name
  • version
  • type

Payload format is as follows:

Code Block
{ name: "Artifact Name", type: "Artifact Type", version: “Version Number", Attribute-N: “Attribute-N” value } 

...

Code Block
languagejava
POST https://localhost:9443 /governance/restservices { name: "TestRESTService", type: "restservice", context: "/test", version: "1.0.0" }

...

Code Block
languagejava
curl -X POST -H "Authorization: Basic YWRtaW46YWRtaW4=" -H "Content-Type: application/json" -H "Cache-Control: no-cache" -d '{
  "name":"TestRESTService",
  "type":"restservice",
  "context":"/test",
  "version":"1.0.0"
}' "https://localhost:9443/governance/restservices" -i -k

...

If the artifact creation is successful, the server will return HTTP 200 code along with the “location” header pointing to the newly created artifact. If there is an issue creating a new artifact, it will return an appropriate error code.  

For example, the above example may return the following:

HTTP 200

Location: https://localhost:9443/governance/restservices/3ec1dcd9-66d8-41da-a0d2-ec171df64cc3

Update an existing asset

Syntax  

PUT /governance/<asset_short_name_s>/uuid <payload>

Here the payload should be in JSON format. Following are the required attributes.

  • name
  • version
  • type

Payload format is as follows: 

Code Block
{ name: "Artifact Name", type: "Artifact Type", version: “Version Number", Attribute-N: “Attribute-N” value }
Example
Code Block
languagejava
PUT https://localhost:9443 /governance/restservices/324dsdwa535 { name: "TestRESTService", type: "restservice", context: "/test-new", version: "1.0.0", }
Sample cURL Command
Code Block
languagejava
curl -X PUT -H "Authorization: Basic YWRtaW46YWRtaW4=" -H "Content-Type: application/json" -H "Cache-Control: no-cache" -d '{
  "name":"TestRESTService",
  "type":"restservice",
  "context":"/test",
  "version":"1.0.0",
  "description": "Discription added by Rest API"
}' "https://localhost:9443/governance/restservices/97bdb275-2b09-4744-b29f-125cf2c8e387" -i -k
ResponseIf the artifact creation is successful, the server will return HTTP 201 code along with the “location” header pointing to the newly created artifact. If there is an issue creating the new artifact, it will return an appropriate error code.

...