-
Notifications
You must be signed in to change notification settings - Fork 0
API Documentation
Open Rousseau edited this page Oct 27, 2020
·
2 revisions
The API currently has 10 endpoints: Auth, authenticate, authenticate (submitTwoFactorCode), authenticate (twoFactorExtraAction), Token, Events feed, Direct Uploads, Blog Instant Article & GraphQL query.
For registration the App redirects to this url:
https://sso.rousseau.movimento5stelle.it/auth/realms/rousseau/protocol/openid-connect/registrations?
"client_id": <string>, "redirect_uri": <string>, "response_mode": <string>, "response_type": <string>, "scope": <string>
// As per register screen on web "body" = { "name":<string>, "surename":<string>, "dateofbirth":<string>, "sex":<string>, "email":<string>, "password":<string>, "country":<string>, "residence_data":<string>, "phonenumber":<string>, },
{ “loginUrl”: <string>, “forgotPasswordUrl”: <string>, “errors”: [ { <string> }, { <string> } ] }
For Forgot Password the App redirects to this url:
https://sso.rousseau.movimento5stelle.it/auth/realms/rousseau/protocol/openid-connect/forgotpassword?
"client_id": <string>, "redirect_uri": <string>, "response_mode": <string>, "response_type": <string>, "scope": <string>
// As per Forgot screen on web "body" = { "email":<string>, },
{ “forgotPasswordUrl”: <string>, “errors”: [ { <string> }, { <string> } ] }
Method | Route | Description |
---|---|---|
GET | /protocol/openid-connect/auth | Get Authentication token from keyloack server |
"nonce": <string>, "state": <string>, "client_id": <string>, "redirect_uri": <string>, "response_mode": <string>, "response_type": <string>, "scope": <string>
{ “loginUrl”: <string>, “registerUrl”: <string>, “forgotPasswordUrl”: <string>, “errors”: [ { <string> }, { <string> } ] }
Method | Route | Description |
---|---|---|
POST | /login-actions/authenticate | Authenticate user |
"session_code": <string>, "execution": <string>, "tab_id": <string>, "client_id": <string>
{ “loginUrl”: <string>, “errors”: [ { <string> }, { <string> } ] }
Method | Route | Description |
---|---|---|
POST | /login-actions/authenticate | Submit the sms code |
"session_code": <string>, "execution": <string>, "tab_id": <string>, "client_id": <string>
"body" = { "smsCode":<string> },
{ “loginUrl”: <string>, “errors”: [ { <string> }, { <string> } ] }
Method | Route | Description |
---|---|---|
POST | /login-actions/authenticate | Extra action for two factor authentication, resend or voice call |
"session_code": <string>, "execution": <string>, "tab_id": <string>, "client_id": <string>, "action": <string>,
{ “loginUrl”: <string>, “errors”: [ { <string> }, { <string> } ] }
Method | Route | Description |
---|---|---|
POST | /protocol/openid-connect/token | Get token |
"code": <string>, "refresh_token": <string>, "client_id": <string>, "redirect_uri": <string>, "grant_type": <string>
{ "access_token": instance.accessToken, "expires_in": instance.expiresIn, "refresh_expires_in": instance.refreshExpiresIn, "refresh_token": instance.refreshToken, "token_type": instance.tokenType, "not-before-policy": instance.notBeforePolicy, "session_state": instance.sessionState, "scope": instance.scope, "error": instance.error, "error_description": instance.errorDescription, “errors”: [ { <string> }, { <string> } ] }
https://partecipa.ilblogdellestelle.it
Method | Route | Description |
---|---|---|
GET | /wp-json/app/events_feed | Get event feeds based on the region |
"region": <String>
{ "events": [ { "title": <String>, "subtitle": <String>, "campaign": <String>, "squareImage": <String>, "coverImage": <String>, "permalink": <String>, "marker": <String>, "newDescription": <String>, "legacyDescription": <String>, "dates": { "date": <String>, "start": <String>, "end": <String>, "timestamp": <String>, }, "place": { "formatted_address": <String> } } ] }
https://partecipa.ilblogdellestelle.it
Method | Route | Description |
---|---|---|
POST | /files/direct_uploads | Upload files on the server |
"blob": { "byteSize": <String>, "checksum": <String>, "filename": <String>, "contentType": <String> }
{ "id": <Double>, "key": <String>, "filename": <String>, "contentType": <String>, "byteSize": <Double>, "checksum": <String>, "createdAt": <String>, "signedId": <String>, "directUpload": { "url": <String> } }
https://partecipa.ilblogdellestelle.it
Method | Route | Description |
---|---|---|
GET | /wp-json/mobile_api/v1/ia_posts | Get the list of blogs |
"offset": <String>, "per_page": <String>
{ "id": <Int>, "title": <String>, "image": <String>, "date": <DateTime>, "text": <String>, "summary": <String>, "url": <String>, "slug": <String>, "author": { "name": <String>, "avatar": <String>, }, "category": { "name": <String> } }
Method | Route | Description |
---|---|---|
GET | /wp-json/mobile_api/v1/ia_post | Get detail of a blog |
"slug": <String>
{ "id": <Int>, "title": <String>, "image": <String>, "date": <DateTime>, "text": <String>, "summary": <String>, "url": <String>, "slug": <String>, "author": { "name": <String>, "avatar": <String>, }, "category": { "name": <String> } }
The endpoint for Poll & Vote are same the difference is in the GraphQL queries.
https://partecipa.ilblogdellestelle.it
Route | Description |
---|---|
/graphql | Used for voting |
String listPolls = ''' query listPolls { polls(orderAttribute: show_starting_date, orderDirection: DESC) { id slug title status alreadyVoted showStartingDate voteStartingDate voteEndingDate announcementLink resultsLink alerts { message } options { id __typename ...on EntityOption { entity { __typename } } } } } ''';
String pollDetail = ''' query pollDetail(\$pollId: ID!) { poll(id: \$pollId) { id slug title status description alreadyVoted showStartingDate voteStartingDate voteEndingDate announcementLink resultsLink optionType maxSelectableOptionsNumber options { id __typename ...on TextOption { text } ...on EntityOption { entity { __typename ...on User { id slug fullName overseaseCity profile { age placeOfResidence { comuneName provinciaName } picture { originalUrl } } badges { code active name } } } } } } } ''';
mutation pollAnswerSubmit(pollId <String>, optionIds List<String>) { user { pollAnswerSubmit(pollId <String>, optionIds List<String>) { errors } } }
returns boolean