Description
This endpoint must be used for download player configuration
This endpoint must be consumed in POST request
Security
This endpoint is secured, you must send a Bearer Token, to be able to invoke the endpoint, for getting the token, you should invoke first the /oauth/token service of the security microservice, if you don't know what service is, please talk with your sysadmin for further information
Request
As part of the request headers a Basic Auth must be sended:
This must be sended in the Http headers of the request, look at the next curl example for a better understanding
Copy codecurl --location '{{host}}:{{port}}/{{context}}/v1/player-setup/download' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer ••••••' \ --data '{ "header": { "transactionId": "123455566677788" }, "data": { "clientId": 38, "playerConfigId": 190, "playerName": "PlayerTestApi", "playerDescription": "This is a test from API", "playerDwsPassword": "123", "playerLwsPassword": "123", "setupType": 1 } }'
In java it would be something like this (depending on the dependency you use)
Copy codeOkHttpClient client = new OkHttpClient().newBuilder() .build(); MediaType mediaType = MediaType.parse("application/json"); RequestBody body = RequestBody.create(mediaType, "{\r\n \"header\": {\r\n \"transactionId\": \"123455566677788\"\r\n },\r\n \"data\": {\r\n \"clientId\": 38,\r\n \"playerConfigId\": 190,\r\n \"playerName\": \"PlayerTestApi\",\r\n \"playerDescription\": \"This is a test from API\",\r\n \"playerDwsPassword\": \"123\",\r\n \"playerLwsPassword\": \"123\",\r\n \"setupType\": 1\r\n }\r\n}"); Request request = new Request.Builder() .url("{{host}}:{{port}}{{context}}/v1/player-setup/download") .method("POST", body) .addHeader("Content-Type", "application/json") .addHeader("Authorization", "Bearer ••••••") .build(); Response response = client.newCall(request).execute();
Next are listed the params required in the request body
| Field | SubField | Type | Description | IsRequired |
|---|---|---|---|---|
| header | object | Y | ||
| transactionId | text | A custom value to identify the data related to the request in the response (you can see the transactionId in the response header). Example:
Note: This field is not related to the creation of a new campaign, must be used by the client app in order to identify the request/response (if that is useful), the same value can be sended in multiple request (it’s not validated that the same value was sended before) | N | |
Data | | Object | The specific body data related to the request | Y |
clientId | int | The clientId related to the request | Y | |
playerConfigId | int | The player config id related to the player config This id can be retrieved by invoking the
rest service | Y | |
playerName | text | The name of the device | Y | |
playerDescription | text | The description of the device | Y | |
playerDwsPassword | text | The device DWS password | Y | |
playerLwsPassword | text | The device LWS password | Y | |
setupType | int | The setup type, can be some of the following:
| Y |
Consuming Service
Example Request
Consuming service
(POST) URL:HOST:PORT/zynchro.api.player-config/v1/player-setup/download
Request Body (JSON RAW):
Copy code{ "header": { "transactionId": "123455566677788" }, "data": { "clientId": 38, "playerConfigId": 190, "playerName": "PlayerTestApi", "playerDescription": "This is a test from API", "playerDwsPassword": "123", "playerLwsPassword": "123", "setupType": 1 } }
Response
Response 200 OK
If the params present in the request are valid, then you will receive a response 200 "ok" message code and you can be able to download the zip file.
If you want to test the service in postman you must send the request with the Send & Download button:
Response 400
If there are errors with the request, then you will receive a 400 message response BAD_REQUEST with the errors field present, like the following example:
Copy code{ "header": { "resultCode": "error", "messageCode": "BAD_REQUEST", "messageDescription": "Please check your params fields", "transactionId": "123455566677788" }, "errors": [ { "fieldName": "playerLwsPassword", "fieldDesc": "Field is required, and must be of type String " }, { "fieldName": "clientId", "fieldDesc": "Field is required, and must be of type int and > 0 " }, { "fieldName": "playerName", "fieldDesc": "Field is required, and must be of type String " }, { "fieldName": "playerDescription", "fieldDesc": "Field is required, and must be of type String " }, { "fieldName": "playerConfigId", "fieldDesc": "Field is required, and must be of type int and > 0 " }, { "fieldName": "playerDwsPassword", "fieldDesc": "Field is required, and must be of type String " } ] }
Response 401
If you dont send any token, then you will receive a error message of "unauthorized", look at the next example:
Copy code{ "error": "unauthorized", "error_description": "Full authentication is required to access this resource" }
If you send a Token, but the Token you are sending is expired, then you will receive a response message with an "invalid_token" error, look at the next example:
Copy code{ "error": "invalid_token", "error_description": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3MDM2MTk5NzMsInVzZXJfbmFtZSI6ImFsZWphbmRyby56YW5hYnJpYUBkaWdpd29ya3MuY29tLm14IiwiYXV0aG9yaXRpZXMiOlsiUk9MRV9TWVNURU1BRE1JTiJdLCJqdGkiOiJHTGtQb3hQbVRTZUs2RFhmc1NfNkUxRkMxZmsiLCJjbGllbnRfaWQiOiJ6eW5jaHJvIiwic2NvcGUiOlsicmVhZCIsIndyaXRlIl19.yAFbdU18wMtQXSGUY3_noQn4BQv0RqYjDbw0sr1x6Yk" }
This is the data retrieved when the 401 Unauthorized is retrieved:
| Field | SubField | Type | Description |
|---|---|---|---|
error | | text | The type of the error, can be:
|
error_description | text | The description of the error, for the "invalid_token", this field retrieves the bearer token you're sending |