What is REST API?
The ApiCode distribution REST API provides programmatic access to 'Read' and 'Write' replication data. The REST API identifies the application and its users using OAUTH ; and, responses are available in JSON. We have used SWAGGER editor for the end users to make the API calls so that they can try out APIs exposed by API management platform.
Click Here to access the CW-API management platform for unregistered user.
Checklist Before Getting Started:
- User should have the release of 4.2.9 or later.
- Have a valid credentials of DBSync API management platform.
- Have a valid credentials of bitbucket.
There are various API methods list that are exposed in this release. We will be adding more methods in the upcoming releases.
ApiCode-Distribution
The ApiCode-distribution is an API that is used to deploy ApiCode based on REST services from a Git repository to the underlying Api management server.
Tables below explains various model schemas and attributes that form the model class:
ApiCode Server Params
Parameter | Description | Data Type |
|---|---|---|
apiCodeServerUsername(optional) | The Username of the ApiCode server instance. | String |
apiCodeServerPassword(optional) | The Password of the ApiCode server instance. | String |
environment(optional) | User has the flexibility to define his/her environment in which s/he wishes to deploy the code base. | String |
Git Repository Params
Parameter | Description | Data Type |
|---|---|---|
url(optional) | The Git repository url of the user from which he would like to deploy the code base. | String |
branch(optional) | The branch inside of a repository from which the user wishes to deploy the code base. | String |
username(optional) | Valid User name of the Git repository | String |
password(optional) | Valid password of the Git repository | String |
Run Properties Params
Below table gives the attribute list of the response class
Parameter | Description | Data type |
ServiceURL(optional) | The website url to access the service. | String |
docURL(optional) | Retrieves the URL of the file in the web layout directory. | Date |
SwaggerURL(optional) | The swagger url is the return type on which the response is listed. | Date |
status(optional) | The possible values are True and False. It sends out the response value. | String |
errorMessage(optional) | In case the status value is False, an error message is returned. | Array[string] |
Example of an Unsuccessful Deployment
Curl
curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' -d '{"appCodeServerUsername":"anil.b@mydbsync.com","appCodeServerPassword":"dbsync2015","environment":"dev","url":"https://sureshullagaddi@bitbucket.org/dbsync/amazons3.git","branch":"dev","username":"suresh.u@avankia.com","password":"suresh@12345"}' 'https://staging.mydbsync.com:443/api/appcode/v1/appcode-distribution/gitCompile'
Request URL
https://staging.mydbsync.com:443/api/appcode/v1/appcode-distribution/gitCompile.
Response Body
{
"error": "AppCode:appcode-distribution does not exist, Please check your URL".
}
Response Code
200.
Response Header
{
"access-control-allow-origin": "*",
"date": "Fri, 24 Feb 2017 13:23:54 GMT",
"connection": "Keep-Alive",
"keep-alive": "timeout=150, max=92","content-length": "78",
"content-type": "application/json"
}