-
Notifications
You must be signed in to change notification settings - Fork 3
Partner Integration APIs
All partner configuration APIs are protected using SESSION_SECRET of the backend, it needs to be passed in x-auth-token
header
Curl to create solution set by partner
curl --location --request GET 'https://mathshare-api-qa.diagramcenter.org/api/solution/create/{setShareCode}?studyPlanResourceId=1234&endpoint=externalResourceTracking&version=tstab' --header 'x-partner-token: API_KEY_ID'
This API takes in 3 optional GET params: studyPlanResourceId, endpoint and version. These are stored with the solution set and get used in replacing request params for submission requests
Curl to create partner
curl --location --request POST 'https://mathshare-api-qa.diagramcenter.org/partner --header 'Content-Type: application/json' --header 'x-auth-token: SESSION_SECRET' --data-raw '{ "name": "EdReady Co", "code": "EdReady", "config": { "auth": { "url": "https://{{version}}.test.org/api/v2/externalApplication?identifier=Mathshare", "replaceParams": true, "mechanism": "jwt-secret", "secretKey": "mysecretkey", "tokenPath": "token", "jwtPayload": { "sub": "Mathshare" } }, "submit": { "url": "https://{{version}}.test.org/api/v2/externalApplication/{{endpoint}}", "replaceParams": true, "payload": { "newData": "#/app/problemSet/review/${shareCode}", "resourceIdentifier": "#/app/problemSet/solve/${editCode}", "externalApplicationName": "Mathshare" }, "staticHeaders": {} } } }'
Auth is optional in the config, currently supported auth strategy is 'jwt-secret', it gets used in finding the authentication headers for submission request to the partner. In 'jwt-secret' startegy, a JWT token with 'auth.jwtPayload' data is encoded with a auth.secretKey
. This token is posted on the endpoint in auth.url
and the resulting token is then used for the submit request.
This returns the apiKey to be shared with the partner.
Curl to update partner is almost same as the partner creation, with the difference of partnerId
curl --location --request PATCH 'https://mathshare-api-qa.diagramcenter.org/partner' --header 'Content-Type: application/json' --header 'x-auth-token: SESSION_SECRET' --data-raw '{ "partnerId": "uuid", "code": "EdReady", "name": "EdReady Co", "config": {} }'
curl --location --request POST 'https://mathshare-api-qa.diagramcenter.org/partner/key' --header 'Content-Type: application/json' --header 'x-auth-token: SESSION_SECRET' --data-raw '{ "partnerId": "uuid", "expiresAfter": 5 }'
expiresAfter is optional number of days after which existing api key should expire, if not sent active api keys will expire instantly