Versions Compared

Key

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

...

Get list of assets of certain type

xyz  - name xyz value is 5 - name xyz with version abc - ServiceLifeCycle - name usa - whether country is an rxt attribute xml - searches only soap services with version 5  WSO2 G-Reg does not support date range searches in Governance REST API
Syntax  
  • GET /governance/<asset_short_name_s>
  • GET /governance/<asset_short_name_s>?query 
Supported Query Format
Warning

WSO2 G-Reg does not support date range searches in Governance REST API.

QueryDescription
xyz

Looks for artifacts with

the name "xyz".

Info
  • You can give only the value like above or give the field name and the value in a key-value pair for fields of the Overview table in the asset RXT file. (e.g. name=xyz)
  • However, to find assets with a specific value for a field in a table other than the Overview table, the search query should be:
    encode(table_name:field_name)=encode(value)
    For example, if the table is docLinks, the field is documentType and the
  • valueis 'the rest1'. The final URI query parameter should be: docLinks%3AdocumentType=the%20rest1
  • If you have spaces or any special characters such as underscore or slash in the key of the key-value pair of your query URL, you need to encode it using a URL encoder.


xyz&version=1.3.
5Looks for artifacts with
the name 'xyz' and version '1.3.5'.
tags=
abcSearches for artifacts with the tag 'abc'.
lcState=development&lcName=
ServiceLifeCycleSearches for artifacts with an associated life cycle
named 'ServiceLifeCycle' with the state 'development'
country=
usaLooks for all the artifacts having attribute country with value 'usa'. This internally handles
whether 'country' is an RXT attribute or a property.
version=1.3.5&mediaType=application/vnd.wso2-soap-service+
xmlSearches for SOAP services of version '1.3.
Warning
5'.


Example(s)
  • GET https://localhost:9443//governance/restservices
  • GET https://localhost:9443//governance/restservices?name=restservice1 GET https
  • GET https://localhost:9443//governance/ restservices?name=restservice1&version=1.0.0
  • GET https://localhost:9443/governance/restservices?docLinks%3AdocumentComment=rest1%20is%20a%20simple%20API
Sample cURL Command(s)
  • curl -X GET -H "Authorization: Basic YWRtaW46YWRtaW4=" -H "Cache-Control: no-cache" "https://localhost:9443/governance/restservices"
    -i
  • curl -X GET -H "Authorization: Basic YWRtaW46YWRtaW4=" -H "Cache-Control: no-cache" "https://localhost:9443/governance/restservices?name=WarrantyClaimService" -i -k
  • curl -X GET -H "Authorization: Basic YWRtaW46YWRtaW4=" -H "Cache-Control: no-cache" "https://localhost:9443/governance/restservices?name=WarrantyClaimService&version=1.0.0" -i -k

 

 

 

  
  

...

Get an asset of a certain type

Syntax  GET  /governance/<asset_short_name_s>/UUID 
ExampleGET

...

 https://localhost:9443/ /governance/restservices/3245se24553 
Sample cURL Command

curl -X GET -H "Cache-Control: no-cache" "https://localhost:9443/governance/restservices/cae93ba9-9543-43be-9f30-bb96cec3c443" -i

...

-k

  1.  

  2.  


  3. wow

  4.  

  5.  

  6.  

  7.  

     

      

  8.  

    Syntax  POST  /governance/<asset_short_name_s> <payload>
    ExampleHere 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 } 

    For example;

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

    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

  9. Update an existing asset

     

    Syntax  PUT /governance/<asset_short_name_s>/uuid<payload>
    ExampleHere 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 }

    For 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

    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.
  10. Delete an asset

     

    Syntax  DELETE  /governance/<asset_short_name_s>/UUID
    ExampleDELETE   https://localhost:9443 /governance/restservices/3245se24553
    Sample cURL Commandcurl -X DELETE -H "Authorization: Basic YWRtaW46YWRtaW4=" -H "Cache-Control: no-cache" "https://localhost:9443/governance/restservices/97bdb275-2b09-4744-b29f-125cf2c8e387" -i -k
  11. Get lifecycle state of an asset

     

    Syntax  
    • GET /governance/<RXT_short_name_s>/uuid/states
    • GET /governance/<RXT_short_name_s>/uuid/states?lc=LCName 
    Example
    Sample cURL Command
  12. Update lifecycle change of an asset
     

     

    Syntax  

    PUT  /governance/<RXT_short_name_s>/uuid/states    payload  

    Payload format

    {

    lc: "Lifecycle name",

    action: "Promote",

    check_item_N : "value_N",

    Example

    PUT https://localhost:9443/governance/restservices/cea0c482-4280-4837-8126-3fd97cdc0a41/states

    {
    lc: "ServiceLifeCycle",

    action: "Promote",

    item_0 : "true",

    item_1 : "true",

    item_2 : "true"

    }
    Sample cURL Command

    curl -X PUT -H "Authorization: Basic YWRtaW46YWRtaW4=" -H "Content-Type: application/json" -H "Cache-Control: no-cache" -d '{
    "lc":"ServiceLifeCycle",
    "action":"Promote",
    "item_0":"true",
    "item_1":"true",
    "item_2":"true"
    }' "https://localhost:9443/governance/restservices/cae93ba9-9543-43be-9f30-bb96cec3c443/states" -i -k

...