Skip to content

Instantly share code, notes, and snippets.

@athiththan11
Last active September 24, 2019 09:18
Show Gist options
  • Save athiththan11/5d67ee4f67f298c48066556ae7a94a97 to your computer and use it in GitHub Desktop.
Save athiththan11/5d67ee4f67f298c48066556ae7a94a97 to your computer and use it in GitHub Desktop.
APIM CURL Commands for WSO2 Trilogy Medium
@consumer-key = <Replace with Consumer Key>
@consumer-secret = <Replace with Consumer Secret>
@api-hostname = https://10.100.5.220:8244/dev-management/v1.0.0
# Username & Password
@api-username = admin
@api-password = admin
@username = athiththan11
### Token Endpoint
# @name tokenEndpoint
curl -k -d "grant_type=password&username={{api-username}}&password={{api-password}}&scope=default" \
-H "Authorization: Basic <Replace with Base64Encode(ClientID:ClientSecret)>" \
https://localhost:8244/token
@access-token = {{tokenEndpoint.response.body.access_token}}
@authorization = Bearer {{access-token}}
### Get Developer
# @name getDeveloperAPI
curl -k -X GET {{api-hostname}}/devs/{{username}} \
-H "accept: application/json" \
-H "Authorization: {{authorization}}"
### Get Repos of a Developer
# @name getReposAPI
curl -k -X GET {{api-hostname}}/devs/{{username}}/repos \
-H "accept: application/json" \
-H "Authorization: {{authorization}}"
### Delete a Developer
# @name deleteDeveloperAPI
curl -k -X DELETE {{api-hostname}}/devs/{{username}} \
-H "accept: application/json" \
-H "Authorization: {{authorization}}"
### Create a Developer
# @name addDeveloperAPI
curl -k -X POST {{api-hostname}}/devs \
-d '{ "username": "athiththan11", "name": "Athiththan", "email": "athiththan11@test.com" }' \
-H "Content-Type: application/json" \
-H "accept: application/json" \
-H "Authorization: {{authorization}}"
### Create a Repo
# @name addRepoAPI
curl -k -X POST {{api-hostname}}/repos \
-d '{ "name": "repodews", "username": "athiththan11", "forks": 0 }' \
-H "Content-Type: application/json" \
-H "accept: application/json" \
-H "Authorization: {{authorization}}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment