Feedback Lembaga Pendidikan

TPM dan UK - LP Submission

API Feedback LP di hit ketika lembaga pelatihan ingin menilai tugas yang sebelumnya telah di-submit oleh peserta, baik untuk TPM maupun UK.

Request

1curl --location 'https://api.prakerja.go.id/api/v1/integration/tpm/feedback/submission \
2--header 'Content-Type: application/json' \
3--header 'client_code: CLIENT_CODE' \
4--header 'signature: SIGNATURE' \
5--header 'timestamp: TIMESTAMP_UNIX_IN_SECONDS' \
6--data '{
7  "redeem_code":"REDEEM_CODE",
8  "scope":"tpm",
9  "sequence":2,
10  "notes":"NOTES",
11  "url_file":"URL_FILE"
12}'
Endpoint Path
Method
POST
Header
KeyValue
Content-Typeapplication/json
client_codeUnique Client ID yang disediakan Prakerja ke DP / LP.
Prakerja akan menyediakan credential yaitu kombinasi client_code dan sign_key ke DP / LP.
signatureSignature dibuat dari raw_signature yang di-hashing menggunakan algoritma HMAC-SHA1 dengan sign_key yang disediakan Prakerja ke DP / LP
timestamp

Format nilai waktu dalam satuan detik yang digunakan saat melakukan hit API

Contoh 1698289216 = 26-10-2023 10:00:16 WIB = 2023-10-26T10:00:16+07:00

Body (Payload)
FieldTypeDescription
redeem_codestring, requiredkode yang didapatkan oleh user prakerja ketika sukses membeli pelatihan.
scopestring / enum, required
  • tpm : Tugas Praktik Mandiri
  • uk : Unjuk Keterampilan
sequenceinteger, required
  • 1-998 : TPM (Tugas Praktik Mandiri)
  • 999 : UK (Unjuk Keterampilan)
notesstring, requiredCatatan penilaian
url_filestring, optional

URL file attachment, feedback dari LP menilai tugas yang sebelumnya telah di-submit oleh peserta. Boleh lebih dari 1 kali submit TPM/UK, namun pada di setiap kali submit hanya boleh berisi 1 url file.

Kecuali untuk format video, disarankan untuk mengupload terlebih dahulu di Youtube atau platform video lainnya, diharuskan public (tidak diprivate), lalu url tersebut diketik di file text .txt atau .md , 1 file text bisa memuat lebih dari 1 url Youtube.

Response

Success Response

Response 200 OK

1{
2  "success": true,
3  "message": "OK",
4  "data": {
5    "id": 2,
6    "redeem_code": "ae96b6bf-724f-11ee-8d03-08c0eb662d76",
7    "scope": "tpm",
8    "sequence": 2,
9    "status": 2,
10    "url_file": "https://www.antennahouse.com/hubfs/xsl-fo-sample/pdf/basic-link-1.pdf",
11    "notes": "sudah bagus"
12  }
13}

Response Detail

FieldTypeDescription
successbooleanStatus hit API,
  • true : sukses
  • false : gagal
messagestringDeskripsi status hit API
data.idintegerID data TPM
data.redeem_codestringredeem_code pada request payload
data.scopestring
  • tpm : Tugas Praktik Mandiri
  • uk : Unjuk Keterampilan
data.sequenceinteger
  • 1-998 : TPM (Tugas Praktik Mandiri)
  • 999 : UK (Unjuk Keterampilan)
data.statusinteger
  • 0 : belum submit
  • 1 : sudah submit dan status pending
  • 2 : sudah submit dan status sukses
  • 3 : sudah submit dan status gagal
data.url_filestringURL file attachment, feedback dari LP, menilai tugas yang sebelumnya telah di-submit oleh peserta
data.notesstringCatatan penilaian
Error Response
  • Termasuk juga list error general response
  • Response 400 Bad Request format file yang di upload tidak valid
    1{
    2  "code": "ERRTPM4060",
    3  "message": "format file yang di upload tidak valid",
    4  "success": false
    5}
  • Response 400 Bad Request scope dan sequence tidak sesuai
    1{
    2  "code": "ERRTPM4061",
    3  "message": "scope dan sequence tidak sesuai",
    4  "success": false
    5}
  • Response 400 Bad Request scope tidak ditemukan
    1{
    2  "code": "ERRTPM4062",
    3  "message": "{{scope}} user submission tidak ditemukan",
    4  "success": false
    5}
  • Response 400 Bad Request file tidak boleh kosong
    1{
    2  "code": "ERRTPM4063",
    3  "message": "file tidak boleh kosong",
    4  "success": false
    5}
  • Response 400 Bad Request maksimum karakter hanya 250 karakter
    1{
    2  "code": "ERRTPM4064",
    3  "message": "maksimum karakter hanya 250 karakter",
    4  "success": false
    5}
  • Response 400 Bad Request scope "UK", post test tidak ditemukan
    1{
    2  "code": "ERRTPM4065",
    3  "message": "post test tidak ditemukan",
    4  "success": false
    5}
  • Response 400 Bad Request scope "UK", post test belum selesai
    1{
    2  "code": "ERRTPM4066",
    3  "message": "post test belum selesai",
    4  "success": false
    5}
  • Response 400 Bad Request sistem Prakerja tidak dapat meng-akses URL file attachment
    1{
    2  "code": "ERRTPM4069",
    3  "message": "tidak dapat meng-akses file",
    4  "success": false
    5}
Try this API
 
Example Code
1// Generated by Prakerja Generator
2// for complete documentation please visit https://developer.prakerja.go.id
3
4const crypto = require('crypto-js');
5const axios = require('axios');
6
7const client_code = ''; // provided by Prakerja
8const timestamp = Math.round((new Date()).getTime() / 1000); // generate current timestamp
9const method = 'POST'; // API Method
10const endpoint = '/api/v1/integration/tpm/feedback/submission'; // API Redeem Status Endpoint
11
12const data = {};
13
14const input = client_code + timestamp + method + endpoint + JSON.stringify(data); // create signature input
15const sign_key = ''; // provided by Prakerja
16
17const signature = crypto.HmacSHA1(input, sign_key).toString(crypto.enc.Hex); // generate signature
18
19axios({
20method: 'post',
21url: 'https://api.prakerja.go.id' + endpoint,
22headers: {
23  'Content-Type': 'application/json',
24  'client_code': client_code,
25  'signature': signature,
26  'timestamp': timestamp,
27},
28data
29})
30.then((response) => {
31console.log(response.data)
32})
33.catch((error) => {
34console.log(error.response.data)
35});
1<?php
2// Generated by Prakerja Generator
3// for complete documentation please visit https://developer.prakerja.go.id
4
5$client_code = ''; // provided by Prakerja
6$timestamp = time(); // generate current timestamp
7$method = 'POST'; // API Method
8$endpoint = '/api/v1/integration/tpm/feedback/submission'; // API Redeem Status Endpoint
9
10$data = [];
11
12$input = $client_code . $timestamp . $method . $endpoint . json_encode($data); // create signature input
13$sign_key = ''; // provided by Prakerja
14
15$signature = hash_hmac('sha1', $input, $sign_key); // generate signature
16
17$headers = [
18'Content-Type: application/json',
19'client_code: ' . $client_code,
20'signature: ' . $signature,
21'timestamp: ' . $timestamp,
22];
23
24$ch = curl_init();
25curl_setopt($ch, CURLOPT_URL,            'https://api.prakerja.go.id' . $endpoint );
26curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
27curl_setopt($ch, CURLOPT_POST,           1);
28curl_setopt($ch, CURLOPT_HTTPHEADER,     $headers); 
29curl_setopt($ch, CURLOPT_POSTFIELDS,     json_encode($data));
30$result = curl_exec($ch);
31curl_close ($ch);
32
33print_r("result: ");
34print_r($result);
1# Generated by Prakerja Generator
2# for complete documentation please visit https://developer.prakerja.go.id
3
4from hashlib import sha1
5import hmac
6import time
7import json
8import requests
9
10client_code = '' # provided by Prakerja
11timestamp = str(int(time.time())) # generate current timestamp
12method = 'POST' # API Method
13endpoint = '/api/v1/integration/tpm/feedback/submission' # API Redeem Status Endpoint
14
15data = {}
16
17# create signature input
18input = client_code + timestamp + method + endpoint + json.dumps(data, separators=(',', ':'))
19
20sign_key = '' # provided by Prakerja
21
22# generate signature
23signature = hmac.new(sign_key.encode("utf-8"), input.encode("utf-8"), sha1).hexdigest()
24
25headers = {
26'Content-Type': 'application/json',
27'client_code': client_code,
28'signature': signature,
29'timestamp': timestamp
30}
31
32result = requests.post(
33'https://api.prakerja.go.id' + endpoint,
34headers=headers,
35data=json.dumps(data)
36)
37
38print('result: ')
39print(result.text)
1# Generated by Prakerja Generator
2# for complete documentation please visit https://developer.prakerja.go.id
3
4require 'base64'
5require 'cgi'
6require 'openssl'
7require 'net/http'
8require 'uri'
9require 'json'
10
11client_code = '' # provided by Prakerja
12timestamp = String(Time.now.to_i) # generate current timestamp
13method = 'POST' # API Method
14endpoint = '/api/v1/integration/tpm/feedback/submission' # API Redeem Status Endpoint
15
16data = {}
17
18# create signature input
19input = client_code + timestamp + method + endpoint + JSON.generate(data, quirks_mode: true)
20
21key = '' # provided by Prakerja
22
23signature = OpenSSL::HMAC.hexdigest(OpenSSL::Digest::Digest.new('sha1'), key.encode("ASCII"), input.encode("ASCII"))
24
25uri = URI.parse('https://api.prakerja.go.id' + endpoint)
26request = Net::HTTP::Post.new(uri)
27request.content_type = "application/json"
28request.body = JSON.generate(data, quirks_mode: true)
29request['Client_code'] = client_code
30request['Signature'] = signature
31request['Timestamp'] = timestamp
32
33req_options = {
34use_ssl: uri.scheme == "https",
35}
36
37result = Net::HTTP.start(uri.hostname, uri.port, req_options) do |http|
38http.request(request)
39end
40
41# result.code
42# result.body
43puts 'result: ' + result.body