Documentation for Socialapp
Documentation for API Endpoints
All URIs are relative to https://socialapp.gomezignacio.com
| Class |
Method |
HTTP request |
Description |
| AuthenticationApi |
getAccessToken |
POST /v1/oauth/token |
Get an access token |
| CommentApi |
createComment |
POST /v1/comments |
Create a new comment |
| CommentApi |
getComment |
GET /v1/comments/{id} |
Returns details about a particular comment |
| CommentApi |
getUserFeed |
GET /v1/feed |
Returns a users feed |
| FollowingApi |
getUserFollowers |
GET /v1/users/{username}/followers |
Get all followers for a user |
| RoleApi |
addScopeToRole |
POST /v1/roles/{id}/scopes |
Add a scope to a role |
| RoleApi |
createRole |
POST /v1/roles |
Create a new role |
| RoleApi |
deleteRole |
DELETE /v1/roles/{id} |
Delete a role |
| RoleApi |
getRole |
GET /v1/roles/{id} |
Returns a role |
| RoleApi |
listRoles |
GET /v1/roles |
Returns a list of roles |
| RoleApi |
listScopesForRole |
GET /v1/roles/{id}/scopes |
Returns a list of scopes for a role |
| RoleApi |
removeScopeFromRole |
DELETE /v1/roles/{role_id}/scopes/{scope_id} |
Remove a scope from a role |
| RoleApi |
updateRole |
PUT /v1/roles/{id} |
Update a role |
| ScopeApi |
createScope |
POST /v1/scopes |
Create a new scope |
| ScopeApi |
deleteScope |
DELETE /v1/scopes/{id} |
Delete a scope |
| ScopeApi |
getScope |
GET /v1/scopes/{id} |
Returns a scope |
| ScopeApi |
listScopes |
GET /v1/scopes |
Returns a list of scopes |
| ScopeApi |
updateScope |
PUT /v1/scopes/{id} |
Update a scope |
| URLApi |
createUrl |
POST /v1/urls |
Create a new url |
| URLApi |
deleteUrl |
DELETE /v1/urls/{alias} |
Delete a url |
| URLApi |
getUrl |
GET /v1/urls/{alias} |
Get a url |
| URLApi |
getUrlData |
GET /v1/urls/{alias}/data |
Returns a url metadata |
| UserApi |
changePassword |
POST /v1/password |
Change password |
| UserApi |
createUser |
POST /v1/users |
Create user |
| UserApi |
deleteUser |
DELETE /v1/users/{username} |
Deletes a particular user |
| UserApi |
followUser |
POST /v1/users/{followedUsername}/followers/{followerUsername} |
Add a user as a follower |
| UserApi |
getFollowingUsers |
GET /v1/users/{username}/following |
Get all followed users for a user |
| UserApi |
getRolesForUser |
GET /v1/users/{username}/roles |
Get all roles for a user |
| UserApi |
getUserByUsername |
GET /v1/users/{username} |
Get a particular user by username |
| UserApi |
getUserComments |
GET /v1/users/{username}/comments |
Gets all comments for a user |
| UserApi |
getUserFollowers |
GET /v1/users/{username}/followers |
Get all followers for a user |
| UserApi |
listUsers |
GET /v1/users |
List users |
| UserApi |
resetPassword |
PUT /v1/password |
Reset password |
| UserApi |
unfollowUser |
DELETE /v1/users/{followedUsername}/followers/{followerUsername} |
Remove a user as a follower |
| UserApi |
updateRolesForUser |
PUT /v1/users/{username}/roles |
Update all roles for a user |
| UserApi |
updateUser |
PUT /v1/users/{username} |
Update a user |
| UserApi |
welcome |
GET / |
Welcome to the Socialapp API |
Documentation for Models
Documentation for Authorization
BasicAuth
- Type: HTTP basic authentication
OAuth2
- Type: OAuth
- Flow: application
- Authorization URL:
- Scopes:
- socialapp.users.list: List users
- socialapp.users.create: Create users
- socialapp.users.update: Update users
- socialapp.users.delete: Delete users
- socialapp.users.read: Read a user
- socialapp.comments.list: List comments
- socialapp.comments.create: Create comments
- socialapp.comments.update: Update comments
- socialapp.comments.delete: Delete comments
- socialapp.followers.list: List followers
- socialapp.following.list: List following
- socialapp.roles.list: List roles
- socialapp.roles.create: Create roles
- socialapp.roles.read: Read a role
- socialapp.roles.update: Update roles
- socialapp.roles.delete: Delete roles
- socialapp.scopes.list: List scopes
- socialapp.scopes.create: Create scopes
- socialapp.scopes.read: Read a scope
- socialapp.scopes.update: Update scopes
- socialapp.scopes.delete: Delete scopes
- socialapp.roles.list_scopes: List scopes of a role
- socialapp.roles.scopes.create: Create scopes of a role
- socialapp.roles.scopes.delete: Delete scopes of a role
- socialapp.users.roles.list: List roles of a user
- socialapp.users.roles.create: Create roles of a user
- socialapp.users.roles.update: Update roles of a user
- socialapp.users.roles.delete: Delete roles of a user
- shortly.url.create: Create a url
- shortly.url.update: Update a url
- shortly.url.delete: Delete a url
Contract Testing with Pact
Socialapp now ships a Pact consumer test that verifies how the URL controller
talks to the urlshortener service. Running make contract-test spins up a Pact
mock server, exercises the /v1/urls/{alias}/data call, and writes the contract
to contracts/pacts/Socialapp-UrlShortener.json. Runtime logs land in
contracts/logs/, which is ignored by source control.
The same command also records expectations for Socialapp's user, comment, and
scope APIs in contracts/pacts/socialapp-client-socialapp.json, so downstream
clients can rely on those endpoints as well.
Before you run the contract test, install the Pact CLI and native libraries:
go install github.com/pact-foundation/pact-go/v2@v2.4.2
pact-go -l DEBUG install
If /usr/local/lib is read‑only (common on macOS), run pact-go -l DEBUG install --libDir /tmp
instead or point --libDir at another writable directory.
Then run:
cd socialapp
make contract-test
CI jobs can call ../scripts/run-contract-tests.sh to ensure every contract test
executes for both services before a merge.
Use scripts/publish-contracts.sh with the required PACT_BROKER_* environment
variables (e.g., PACT_BROKER_BASE_URL, PACT_BROKER_VERSION, and credentials)
to push contracts/pacts/socialapp-client-socialapp.json and
contracts/pacts/socialapp-urlshortener.json to your Pact Broker.
Commit the updated file from contracts/pacts/ after regenerating it so the
urlshortener team can verify their provider against the new contract.