Creating your own custom endpoint
In the EasyScore app the golfer will need to navigate to the Upload section and paste in the URL of your REST endpoint. You can use your own URL parameters such as &league=123 if you wish to pass in custom data, not in the scorecard. You could also implement basic auth e.g. http://username:password@example.com .
Data sent from EasyScore mobile app to your REST endpoint. Here is example of the payload that will be sent to your endpoint.
{ "uploadDeviceId": "90B0D556-2795-47A8-BD84-21D624A079E9", "version": 1, "uploadGolferName": "Eric", "uploadTime": 1587432482162, "course": "Medalist", "segments": [{ "type": "front", "startHole": 1, "golfers": [{ "name": "Eric", "score": 42, "putts": 19, "holes": [{ "hole": 1, "par": 4, "strokes": 7, "penalty": 1, "putts": 3, "sandSave": false, "greenInRegulation": false, "fairwayHit": false }, { "hole": 2, "par": 4, "strokes": 4, "penalty": 0, "putts": 2, "sandSave": false, "greenInRegulation": true, "fairwayHit": true }, { "hole": 3, "par": 4, "strokes": 5, "penalty": 0, "putts": 2, "sandSave": false, "greenInRegulation": false, "fairwayHit": true }, { "hole": 4, "par": 4, "strokes": 4, "penalty": 0, "putts": 2, "greenInRegulation": true, "fairwayHit": true }, { "hole": 5, "par": 3, "strokes": 3, "penalty": 0, "putts": 1, "sandSave": true, "greenInRegulation": false }, { "hole": 6, "par": 3, "strokes": 3, "penalty": 0, "putts": 2, "greenInRegulation": true }, { "hole": 7, "par": 4, "strokes": 5, "penalty": 0, "putts": 3, "greenInRegulation": false, "fairwayHit": true }, { "hole": 8, "par": 5, "strokes": 6, "penalty": 0, "putts": 2, "greenInRegulation": false, "fairwayHit": true }, { "hole": 9, "par": 5, "strokes": 5, "penalty": 0, "putts": 2, "greenInRegulation": true, "fairwayHit": true }] }, { "name": "G2", "score": 48, "holes": [{ "hole": 1, "par": 4, "strokes": 5 }, { "hole": 2, "par": 4, "strokes": 5 }, { "hole": 3, "par": 4, "strokes": 8 }, { "hole": 4, "par": 4, "strokes": 5 }, { "hole": 5, "par": 3, "strokes": 5 }, { "hole": 6, "par": 3, "strokes": 6 }, { "hole": 7, "par": 4, "strokes": 5 }, { "hole": 8, "par": 5, "strokes": 5 }, { "hole": 9, "par": 5, "strokes": 4 }] }] }]}
A few notes about the example payload:
version - version of the JSON emitted by EasyScore. Intially this will be 1.
segments - array size 2, representing front and back. "type":"front"|"back"
If a field is missing then it not being collected e.g. putts.
startHole valid values: 1, 10, 19
uploadTime - Milliseconds since Epoch i.e. 1970-01-01T00:00:00Z + millisecondsSinceEpoch ms in the given time zone (local or UTC)
visit https://currentmillis.com/
The app will expect a HTTP response code of 200, or 489. Anything else will be reported as an error in the application
If you want to do custom validation of the incoming payload and you find a problem, then respond with the HTTP response code of 489. Also include the reason upload-validation failed with the following JSON response.
{ "message": "You already submitted your scores to the league network"}In this case the message will show in the app to alert the user of the problem