Description

This endpoint must be used for getting all the clients related to a user/profile in zynchro cms app

This endpoint must be consumed in GET request

Request


As part of the request headers, a Basic Auth must be sent:

Postman Auth Bearer Example

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/zynchro.api.system-config/v1/profiles-user/clients?transaction_id=123456' \
--header 'Authorization: Bearer ••••••'


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("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
  .url("host:port/zynchro.api.system-config/v1/profiles-user/clients?transaction_id=123456")
  .method("GET", body)
  .addHeader("Authorization", "Bearer ••••••")
  .build();
Response response = client.newCall(request).execute();


Next are listed the params required in the request

Field
SubField
Type
Description
IsRequired
transaction_id

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:

  • REQ000001

Note: This field is not related with the data to be retrieved, 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


Consuming Service


Example Request

Consuming service 

(GET) URL:HOST:PORT/zynchro.api.system-config/v1/profiles-users/clients?transaction_id=123456

Request Params:

  • transaction_id=123456


Response


Response 200 OK

If the params present in the request are valid, then you will receive a response 200 "ok" message code look at the next example:

Copy code{
    "header": {
        "resultCode": "ok",
        "messageCode": "ok",
        "messageDescription": "request ok",
        "transactionId": "123456"
    },
    "data": [
        {
            "id": 21,
            "oid": 1518495608449,
            "accountId": 11,
            "name": "Media Services Lab",
            "hasAnalytics": false
        },
        {
            "id": 29,
            "oid": 1571751929494,
            "accountId": 11,
            "name": "Supply Chain Communications",
            "hasAnalytics": true
        },
        {
            "id": 34,
            "oid": 1581520240317,
            "accountId": 11,
            "name": "Life Fitness Center",
            "hasAnalytics": false
        }
    ]
}


Description of the response data

Field
SubField
Type
Description

header

 

Object

Specific data related to the response

 

resultCode

text

The result code of the response, can be:

·         error -> if errors were found

·         ok -> if NO errors were found

 

messageCode

text

The message code related to the result code of the response, can be:

Example:

 

 

messageDescription

text

The description of the message code

Example:

·         request ok

·         Please check your params fields

 

transactionId

text

The transactionId specified in the request, if no transactionId was sended in the request then the transacionId in the response will be null

errors

 

Array

 This field is present if there are errors in the request

 

fieldName

text

The field with errors

 

fieldDesc

text

 The description of the error

Data

 

Array

The specific response data related to the request


id

int

The identifier of the client

Example: 1


oid

text

The origin id


accountId

boolean

The id of the account related to the client


name

boolean

The name of the client


hasAnalytics

boolean

Indicates if the client generates analytics reports


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:

  • unauthorized
  • invalid_token


error_description


text

The description of the error, for the "invalid_token", this field retrieves the bearer token you're sending


Postman collection

File: