2017 © Pedro Peláez
 

library ddgameapi

image

crowdtruth/ddgameapi

  • Wednesday, October 5, 2016
  • by c-martinez
  • Repository
  • 10 Watchers
  • 1 Stars
  • 677 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 2 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

DrDetectiveAPI

API for communication between Dr. Detective and CrowdTruth., (*1)

Package installation

The API is available as a plugin for CrowdTruth, which can be installed via Packagist. To install the API in CrowdTruth, edit your composer.json file to include crowdtruth/ddgameapi:, (*2)

{
  "name": "laravel/laravel",
  "description": "The Laravel Framework.",
  ...
  "require": {
    ...
    "crowdtruth/ddgameapi": "*",
    ...
  },
  ...
}

Use composer to install the package:, (*3)

[CrowdTruth]$ composer update

Add the DDGameapiServiceProvider to the list of providers in your app/config/app.php file:, (*4)

...
'providers' => array(
  ...
  'CrowdTruth\DDGameapi\DDGameapiServiceProvider',
  ...
),
...

Run the package migrations to add the required software components to the CrowdTruth database:, (*5)

[CrowdTruth]$ php artisan db:seed --class="CrowdTruth\DDGameapi\DDGameAPISeeder"

Next, package needs to be configured to communicate with the Dr. Detective game. For this, you must first export the configuration file:, (*6)

[CrowdTruth]$ php artisan config:publish crowdtruth/ddgameapi

and afterwards edit the URL field on the configuration file app/config/packages/crowdtruth/ddgameapi/config.php:, (*7)

return array(
    'URL' => 'http://<your-game-url>/admin-games/api',
);

set the URL to the location where your game instance is installed, for example http://localhost:8080/admin-games/api., (*8)

Last but not least, go to the instructions for configuring this API specific to your game instance. For example https://github.com/CrowdTruth/BioCrowd/wiki/Configurations-for-using-the-DrDetectiveAPI, (*9)

If everything went well, the API has been succesfully installed., (*10)

API description

The API enables a webhook on the following URL: http://<your-CrowdTruth-instance>/game/detective/. This webhook is called from Dr. Detective to send judgments to CrowdTruth. API requests must contain 3 elements (in a JSON structure), (*11)

  • signal -- Signal to be processed. 'new_judgments' for new judgments
  • payload -- a JSON structure with the judgments
  • signature -- SHA1(payload + API_KEY)

Example:, (*12)

{
  "signal": "new_judgments",
  "payload": [
    {
      ...
    },
  ],
  "signature": "f04d10c"
}

The response to such call is also a JSON structure containing: - signal -- Signal received - status -- Return status (ok or error) - message -- Message with additional information., (*13)

{
  "signal": "new_judgments",
  "status": "ok",
  "message": "1 processed"
}

The Versions

05/10 2016

dev-master

9999999-dev

  Sources   Download

The Requires

 

by Crowdtruth

12/06 2015

V0.1

0.1.0.0

  Sources   Download

The Requires

 

by Crowdtruth