Examples

Advanced User Profile API

23 views 0

Sample 1

To develop an application using the profile API first you need to define supported languages as well groups/options and values. You can do this by using the developer portal.

First you need the apiKey for your developer account – application.

Using API’s you can:

  1. Get all Groups for your application.

curl -X GET “https://profile.nestore-coach.eu/api/option_groups?offset=0&limit=10” -H “accept: */*” -H “apiKey: 104_3mqcmmjnixa8044o4g0s88o400k448o4848sw4ckw8g84oooso”

As you can see on swagger you can obtain the translated Groups (if you defined on the developer portal).

  1. Get all Options for one Group 

curl -X GET “https://profile.nestore-coach.eu/api/option_keys?offset=0&limit=10&language=italiano&option_group_name=Preferenze” -H “accept: */*” -H “apiKey: 104_3mqcmmjnixa8044o4g0s88o400k448o4848sw4ckw8g84oooso”

You can get option by using Group Name or By using Group UID – and language

  1. If you need only one Option from a group, you obtain:

curl -X GET “https://profile.nestore-coach.eu/api/option_keys/58d8a05b-ae54-451d-940d-11f28206d3a1?language=italiano” -H “accept: */*” -H “apiKey: 104_3mqcmmjnixa8044o4g0s88o400k448o4848sw4ckw8g84oooso”

On the Options_keys you obtain all the values that are allowed and value types.

In this phase you can let your user select what is appropriate for his/her profile.

Then you need to persist his selection using the  user_options End Point.

{

“user_uid”: “f657d22e-d898-42ad-bc91-6d77649aef90”,

“access_token”: “YTNhNTc1Y2ZhMzU4M2I0N2JhMDFjYjMzMjRiOGQ0NDZlMjY3M2YwYjM3YWM5M2NmNjg0OTVmOWM3YzUzMTMwYQ”,

“option_group_uid”: “952485b5-44eb-4eae-b0b2-cdba83440280”,

“option_key_uid”: “58d8a05b-ae54-451d-940d-11f28206d3a1”,

“value”: [“Formaggi”,”Frutta”,”Verdura”]

}

To persist a user option you need on the payload to send:

  • User UID

Or

  • Access token
  • Option Group UID and Option Key UID
  • Values – as are defined by the Option Key (see the supported values)
  • Language – if you like to store this value on any other language than the default one. If you are using the default one is not necessary this parameter.

The POST will check if the sent values are supported by the Option Key then it will save the sent options on the user’s profile. It will support all defined languages at the time.

Sample 2

For using the Swagger UI, developers must have a valid apiKey = Application ID from the Developer.

authorization

To manage the end user’s selected options, the “user_options” resource is defined.

user options resource

To save an user option POST method must be used:

{ “user_uid”: “e607f514-d0de-4b01-ac01-0c9c2565c658”,

“option_group_uid”: “7e01855c-ea0c-42c2-b2fd-eb663b99054b”,

“option_key_uid”: “a26f08a8-3e4e-4285-82ca-337567aaf202”,

“value”: [ “medium” ] }

Where:

Option_group_id – is refereeing the group – example ““Social Status”.

Option_key_uid – is referring the option – example “Level”.

Value – is an array (for multiple selection) with the end user’s selected value – example “medium”.

The following structure will be stored to DB after saving (POST user_option).

The JSON will contain information about the group, option/s and their translations.

 

{

“user_options_uid”: “36c9f16d-9df6-45fc-9aaa-e9496c36e55b”,

“app_id”: “96_1wsnbi91y2sk8wkgccooss88swok0kkwoow8wwg4kgwkssko8o”,

“user_uid”: “e607f514-d0de-4b01-ac01-0c9c2565c658”,

“group”: {

“name”: “test2”,

“translations”: [{

“option_group_translation_uid”: “093d268c-1634-4fb0-8997-e7e773863c71”,

“name”: “test2”,

“language”: “Italiano”

}]

},

“option”: {

“name”: “optiune3”,

“value”: true,

“translations”: [{

“option_key_translation_uid”: “92a8b331-deb7-4352-ab90-81b259d6f038”,

“language”: “Italiano”,

“name”: “optiune3”,

“value”: true

}]

},

“created_at”: “2018-11-12 13:56:29”,

“updated_at”: “2018-11-12 13:56:29”

}

Was this helpful?

By continuing to use the site, you agree to the use of cookies. More information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.

Close