Social Media Retrieval Scheduling

Overview

The Social Media Retrieval Scheduling service is a mashup service that provides the functionality to schedule background jobs, which periodically (every 30 minutes) retrieve social media posts from configured social media channels.

Before using this service, make sure the services for harvesting data from the target social media channels have been implemented and correctly configured. You can refer to SAP Jam Communities as an example.

You need to create one background job for each target social media channel and configure the endpoint, which can be called to harvest data from this social media channel.

In order to generate a proper token to call the configured social media data harvesting endpoint, create an application in your project and configure the Client ID and Client Secret of this application in a background job.

Using this service, you can:

  • Configure the background job for the target social media channels
  • Automatically start the background jobs, which periodically run to harvest social media posts.


API Reference

/{tenant}/socialHarvestJobs

Configuration of social media harvesting jobs.

/{tenant}/socialHarvestJobs

get

Get configuration of social media harvesting jobs.

Required scope: hybris.socialmanager_configuration_view

post

Create configuration of social media harvesting job.

Required scope: hybris.socialmanager_configuration_manage

put

Update configuration of social media harvesting jobs.

Required scope: hybris.socialmanager_configuration_manage

delete

Delete configuration of social media harvesting jobs. Please note that all social media harvesting jobs will be deleted.

Required scope: hybris.socialmanager_configuration_delete


Scopes

The table shows the scopes that the Social Media Retrieval Scheduling service supports.

SCOPEDESCRIPTION
hybris.socialmanager_configuration_viewView social media retrieval scheduling jobs
hybris.socialmanager_configuration_manageCreate and update social media retrieval scheduling jobs
hybris.socialmanager_configuration_deleteDelete social media retrieval scheduling jobs

For more information about scopes, authorization, and authentication procedures for YaaS services, see Scopes and Authorization.


Social Media Retrieval Scheduling Job Creation

Before Social Media Retrieval Scheduling service (or Scheduling service for short in this document) can periodically trigger the retrieving of social media posts from target social media channels, make sure this applies:

  • Data harvesting services: services for harvesting data from target social media channels have been implemented and configured correctly. The data harvesting service needs to expose an endpoint for data harvesting, which could be consumed by the Scheduling service.

  • Data harvesting client: a client needs to be created in your project with the required scopes that are necessary to consume the data harvesting endpoint of the data harvesting service. The client credentials is used by the Scheduling service to acquire a valid token from the YaaS OAuth server to consume the target endpoint of data harvesting service. For example, scope hybris.sapcommunity_manage, authorization of data harvesting for SAP Jam Communities service, is required in the client for integrating SAP Jam Communities service. And the scope hybris.sapcommunity_manage, authorization of the data harvesting for the SAP Jam Communities service, is required in the client for integrating the SAP Jam Communities service.

  • Background jobs: for example, social media retrieval scheduling job, which must be created for each social media channel.

Create a data harvesting service

The data harvesting service retrieves the social media data by using an API that is provided by social media channels. For example, the data could be an individual post entry in a profile’s feed for Facebook, or a question/answer in an SAP Jam Community. You are responsible for creating the data harvesting service for your target social media channels. For more information, see SAP Jam Communities service.

Create a data harvesting client

To create a data harvesting client, you need to provide these details:

  • Display name: name of the client
  • Description: description of the client (optional)
  • Required Scopes: scopes that control the harvesting of the data harvesting service

Create a social media retrieval scheduling job

To create a scheduling job, you need to provide this information:

  • JobId: a unique ID for the job
  • Description: description for the job (optional)
  • Activated: if set to true, the job is enabled so that the harvesting for the social media channel is scheduled. If set to false, the job is ignored, and the harvesting is not scheduled.
  • HarvestURLEndpoint: an attribute that is set to the data harvesting service URL, concatenated with the endpoint that is used for harvesting in the data harvesting service.
  • RequiredScopes: scopes that are required when a YaaS token is acquired by the Scheduling service. Fill this attribute when creating a job, so that the token used by the Scheduling service has the permission when calling the data harvest service.
  • ClientID: client ID of the data harvesting client
  • ClientSecret: client secret of the data harvesting client

When a job is created, it has a unique ID and contains the information about the harvesting URL, required scopes, and required client credentials for the generation of a YaaS token.

Harvest interval

  • The scheduled interval for each harvesting job is 30 minutes.


Create a Social Media Retrieval Scheduling Job

This example shows how to create a social media retrieval scheduling job.

Request

  • Method: POST
  • Request URL: https://api.beta.yaas.io/hybris/socialmanager/v1/{tenant}/socialHarvestJobs
  • Headers
    • Authorization: This includes a valid OAuth2 access token. To access this method, the access token must be issued for the requested tenant and have the scope hybris.socialmanager_configuration_manage.
  • Body:
    [
      {
          "JobId": "CommunityHarvestJob",
          "Description": "SAP Jam Communities Harvest Job",
          "Activated": "true",
          "HarvestURLEndpoint": "https://api.beta.yaas.io/hybris/sapcommunity/v1/mytenant/harvest",
          "RequiredScopes": "hybris.sapcommunity_manage",
          "ClientID": "2mEE15roinrNNqhEVSlisMfbbDsSL0ZnX",
          "ClientSecret": "xxx"
      }
    ]
    

Response

The successful response returns a 201 status code.


Create Multiple Social Media Retrieval Scheduling Jobs

This example shows how to create multiple social media retrieval scheduling jobs.

If there is already a social media retrieval scheduling job, and you want to create more jobs, refer to Update Social Media Retrieval Scheduling Jobs section.

Request

  • Method: POST
  • Request URL: https://api.beta.yaas.io/hybris/socialmanager/v1/{tenant}/socialHarvestJobs
  • Headers
    • Authorization: This includes a valid OAuth2 access token. To access this method, the access token must be issued for the requested tenant and have the scope hybris.socialmanager_configuration_manage.
  • Body:
    [
      {
       "JobId": "CameraCommunityHarvestJob",
       "Description": "Camera Jam Communities Harvest Job",
       "Activated": "true",
       "HarvestURLEndpoint": "https://api.beta.yaas.io/hybris/sapcommunity/v1/mytenant1/harvest",
       "RequiredScopes": "hybris.sapcommunity_manage",
       "ClientID": "2mEE15roinrNNqhEVSlisMfbbDsSL0ZnX",
       "ClientSecret": "xxx"
      },
      { 
       "JobId": "HeadsetCommunityHarvestJob",
       "Description": "Headset Jam Communities Harvest Job",
       "Activated": "true",
       "HarvestURLEndpoint": "https://api.beta.yaas.io/hybris/sapcommunity/v1/mytenant2/harvest",
       "RequiredScopes": "hybris.sapcommunity_manage",
       "ClientID": "87215roinrNNqhEVSlisMfbbDsSL0ZnX",
       "ClientSecret": "xxx"
      }
    ]
    

Response

The successful response returns a 201 status code.


Retrieve All Social Media Retrieval Scheduling Jobs

This example shows how to display all social media retrieval scheduling jobs.

Request

  • Method: GET
  • Request URL: https://api.beta.yaas.io/hybris/socialmanager/v1/{tenant}/socialHarvestJobs
  • Headers
    • Authorization: This includes a valid OAuth2 access token. To access this method, the access token must be issued for the requested tenant and have the scope hybris.socialmanager_configuration_view.

Response

The successful response returns a 200 status code. An example JSON content in the response body looks similar to this:

[
    {
        "JobId": "CameraCommunityHarvestJob",
        "Description": "Camera Jam Communities Harvest Job",
        "Activated": "true",
        "HarvestURLEndpoint": "https://api.beta.yaas.io/hybris/sapcommunity/v1/mytenant1/harvest",
        "RequiredScopes": "hybris.sapcommunity_manage",
        "ClientID": "2mEE15roinrNNqhEVSlisMfbbDsSL0ZnX",
        "ClientSecret": "xxx"
    },
    {
        "JobId": "HeadsetCommunityHarvestJob",
        "Description": "Headset Jam Communities Harvest Job",
        "Activated": "true",
        "HarvestURLEndpoint": "https://api.beta.yaas.io/hybris/sapcommunity/v1/mytenant2/harvest",
        "RequiredScopes": "hybris.sapcommunity_manage",
        "ClientID": "87215roinrNNqhEVSlisMfbbDsSL0ZnX",
        "ClientSecret": "xxx"
    }
]


Update Social Media Retrieval Scheduling Jobs

This example shows how to update social media retrieval scheduling jobs.

To change only one or a few out of multiple social media retrieval scheduling jobs, list all sets of attributes for the jobs in the JSON body. Modify the attributes of the jobs you want to change, and leave the other jobs unchanged.

Request

  • Method: PUT
  • Request URL: https://api.beta.yaas.io/hybris/socialmanager/v1/{tenant}/socialHarvestJobs
  • Headers
    • Authorization: This includes a valid OAuth2 access token. To access this method, the access token must be issued for the requested tenant and have the scope hybris.socialmanager_configuration_manage.
  • Body: Example of creating a new job based on an existing job:

      Existing job: **CameraCommunityHarvestJob**
    
      "JobId": "CameraCommunityHarvestJob",
      "Description": "Camera Jam Communities Harvest Job",
      "Activated": "true",
      "HarvestURLEndpoint": "https://api.beta.yaas.io/hybris/sapcommunity/v1/mytenant1/harvest",
      "RequiredScopes": "hybris.sapcommunity_manage",
      "ClientID": "2mEE15roinrNNqhEVSlisMfbbDsSL0ZnX",
      "ClientSecret": "xxx"
    

    To create one more job, the request body is:

      The job to add: **HeadsetCommunityHarvestJob**
    [
      {
          "JobId": "CameraCommunityHarvestJob",
          "Description": "Camera Jam Communities Harvest Job",
          "Activated": "true",
          "HarvestURLEndpoint": "https://api.beta.yaas.io/hybris/sapcommunity/v1/mytenant1/harvest",
          "RequiredScopes": "hybris.sapcommunity_manage",
          "ClientID": "2mEE15roinrNNqhEVSlisMfbbDsSL0ZnX",
          "ClientSecret": "xxx"
      },
      {
          "JobId": "HeadsetCommunityHarvestJob",
          "Description": "Headset Jam Communities Harvest Job",
          "Activated": "true",
          "HarvestURLEndpoint": "https://api.beta.yaas.io/hybris/sapcommunity/v1/mytenant2/harvest",
          "RequiredScopes": "hybris.sapcommunity_manage",
          "ClientID": "87215roinrNNqhEVSlisMfbbDsSL0ZnX",
          "ClientSecret": "xxx"
      }
    ]
    

    Example of updating one of two existing jobs:

      Existing jobs: **CameraCommunityHarvestJob** and **HeadsetCommunityHarvestJob**
    
      "JobId": "CameraCommunityHarvestJob",
      "Description": "Camera Jam Communities Harvest Job",
      "Activated": "true",
      "HarvestURLEndpoint": "https://api.beta.yaas.io/hybris/sapcommunity/v1/mytenant1/harvest",
      "RequiredScopes": "hybris.sapcommunity_manage",
      "ClientID": "2mEE15roinrNNqhEVSlisMfbbDsSL0ZnX",
      "ClientSecret": "xxx"
    
      "JobId": "HeadsetCommunityHarvestJob",
      "Description": "Headset Jam Communities Harvest Job",
      "Activated": "true",
      "HarvestURLEndpoint": "https://api.beta.yaas.io/hybris/sapcommunity/v1/mytenant2/harvest",
      "RequiredScopes": "hybris.sapcommunity_manage",
      "ClientID": "87215roinrNNqhEVSlisMfbbDsSL0ZnX",
      "ClientSecret": "xxx"
    

    To update the jobId and description parameters of the CameraCommunityHarvestJob, the request body is:

    [
      {
          "JobId": "UpdatedCameraCommunityHarvestJob",
          "Description": "Updated Camera Jam Communities Harvest Job",
          "Activated": "true",
          "HarvestURLEndpoint": "https://api.beta.yaas.io/hybris/sapcommunity/v1/mytenant1/harvest",
          "RequiredScopes": "hybris.sapcommunity_manage",
          "ClientID": "2mEE15roinrNNqhEVSlisMfbbDsSL0ZnX",
          "ClientSecret": "xxx"
       },
       {
          "JobId": "HeadsetCommunityHarvestJob",
          "Description": "Headset Jam Communities Harvest Job",
          "Activated": "true",
          "HarvestURLEndpoint": "https://api.beta.yaas.io/hybris/sapcommunity/v1/mytenant2/harvest",
          "RequiredScopes": "hybris.sapcommunity_manage",
          "ClientID": "87215roinrNNqhEVSlisMfbbDsSL0ZnX",
          "ClientSecret": "xxx"
      }
    ]
    

    Example of deleting one of two existing jobs:

      Existing jobs: **CameraCommunityHarvestJob** and **HeadsetCommunityHarvestJob**
    
      "JobId": "CameraCommunityHarvestJob",
      "Description": "Camera Jam Communities Harvest Job",
      "Activated": "true",
      "HarvestURLEndpoint": "https://api.beta.yaas.io/hybris/sapcommunity/v1/mytenant1/harvest",
      "RequiredScopes": "hybris.sapcommunity_manage",
      "ClientID": "2mEE15roinrNNqhEVSlisMfbbDsSL0ZnX",
      "ClientSecret": "xxx"
    
      "JobId": "HeadsetCommunityHarvestJob",
      "Description": "Headset Jam Communities Harvest Job",
      "Activated": "true",
      "HarvestURLEndpoint": "https://api.beta.yaas.io/hybris/sapcommunity/v1/mytenant2/harvest",
      "RequiredScopes": "hybris.sapcommunity_manage",
      "ClientID": "87215roinrNNqhEVSlisMfbbDsSL0ZnX",
      "ClientSecret": "xxx"
    

    To delete the job HeadsetCommunityHarvestJob, the request body is:

    [
      {
          "JobId": "CameraCommunityHarvestJob",
          "Description": "Camera Jam Communities Harvest Job",
          "Activated": "true",
          "HarvestURLEndpoint": "https://api.beta.yaas.io/hybris/sapcommunity/v1/mytenant1/harvest",
          "RequiredScopes": "hybris.sapcommunity_manage",
          "ClientID": "2mEE15roinrNNqhEVSlisMfbbDsSL0ZnX",
          "ClientSecret": "xxx"
      }
    ]
    

Response

The successful response returns a 204 status code.


Clean Up All Social Media Retrieval Scheduling Jobs

This example shows how to delete all social media retrieval scheduling jobs.

Request

  • Method: DELETE
  • Request URL: https://api.beta.yaas.io/hybris/socialmanager/v1/{tenant}/socialHarvestJobs
  • Headers
    • Authorization: This includes a valid OAuth2 access token. To access this method, the access token must be issued for the requested tenant and have the scope hybris.socialmanager_configuration_delete.

Response

The successful response returns a 204 status code.


Error Types

For information about error codes, see the API Reference.


  • Send feedback

    If you find any information that is unclear or incorrect, please let us know so that we can improve the Dev Portal content.

  • Get Help

    Use our private help channel. Receive updates over email and contact our specialists directly.

  • hybris Experts

    If you need more information about this topic, visit hybris Experts to post your own question and interact with our community and experts.