WORKBOX Overview
    • PDF

    WORKBOX Overview

    • PDF

    Article Summary

    Overview

    WORKBOX API enables you to set departments, members, job grades, job titles and basic information in the WORKBOX service, using HTTP POST, PUT and DELETE methods.

    Common information

    WORKBOX URL

    POST/PUT/DELETE
    https://workbox.apigw.ntruss.com/workbox/workbox/openapi/v1
    

    Request header

    HeaderDescription
    x-ncp-apigw-timestampIt is the number of milliseconds that have elapsed since January 1, 1970 00:00:00 UTC.
    If the time difference with the API Gateway server is more than 5 minutes, the request is considered invalid.
    x-ncp-apigw-timestamp:{Timestamp}
    x-ncp-apigw-api-keyAPI key issued by API Gateway
    x-ncp-apigw-api-key:{API Gateway API Key}
    x-ncp-iam-access-keyAccess Key ID issued from the NAVER CLOUD PLATFORM portal.
    x-ncp-iam-access-key:{Account Access Key}
    x-ncp-apigw-signature-v1Signature encrypted with your Access Key ID and Secret Key.
    x-ncp-apigw-signature-v1:{API Gateway Signature}
    Content-TypeSet the request body content type to application/json.
    Content-Type: application/json

    Authorization header

    The WORKBOX API is provided via NAVER CLOUD PLATFORM’s API Gateway, which requires you to get three authentication keys, Access Key ID, Secret Key, and API Key.

    For more information, refer to NAVER Cloud Platform API.

    • Create authentication keys
      • Go to My Page > Manage Account > Manage Auth Key on NAVER CLOUD PLATFORM’s portal, and click Create a New API Authentication Key to create an Access Key ID and Secret Key
      • You can use your existing Access Key ID and Secret Key.

    Request example

    curl -i -X GET \
       -H "x-ncp-apigw-timestamp:1505290625682" \
       -H "x-ncp-apigw-api-key:cstWXuw4wqp1EfuqDwZeMz5fh0epaTykRRRuy5Ra" \
       -H "x-ncp-iam-access-key:D78BB444D6D3C84CA38A" \
       -H "x-ncp-apigw-signature-v1:WTPItrmMIfLUk/UyUIyoQbA/z5hq9o3G8eQMolUzTEo=" \
     'https://workplageg.apigw.ntruss.com//calendar/v1/holiday?year=2018&locale=ko_KR&companyId=e721e2da-29ee-4782-9672-3d2b150ac1a6'
    
    • Create a signature (Add a new line with \n.)

      • Create a StringToSign appropriate for your request, encrypt it with your secret key and the HMACSHA256 algorithm and encode it with Base64
      • Use this value as x-ncp-apigw-signature-v1.
    • Sample code

    public String makeSignature() {
        String space = " ";  // Empty space
        String newLine = "\n";  // Line break
        String method = "GET";  // HTTP method
        String url = "/calendar/v1/holiday?year=2018&locale=ko_KR&companyId=e721e2da-29ee-4782-9672-3d2b150ac1a6";  // Full URL under "/", except for the domain (including query strings)
        String timestamp = "{timestamp}";  // Current time stamp (epoch, millisecond)
        String apiKey = "{apiKey}";  // api key (from api gateway)
        String accessKey = "{accessKey}";  // access key id (from portal or Sub Account)
        String secretKey = "{secretKey}";  // secret key (from portal or Sub Account)
    
        String message = new StringBuilder()
            .append(method)
            .append(space)
            .append(url)
            .append(newLine)
            .append(timestamp)
            .append(newLine)
            .append(apiKey)
            .append(newLine)
            .append(accessKey)
            .toString();
    
        SecretKeySpec signingKey = new SecretKeySpec(secretKey.getBytes("UTF-8"), "HmacSHA256");
        Mac mac = Mac.getInstance("HmacSHA256");
        mac.init(signingKey);
    
        byte[] rawHmac = mac.doFinal(message.getBytes("UTF-8"));
        String encodeBase64String = Base64.encodeBase64String(rawHmac);
    
      return encodeBase64String;
    
    }
    

    Common errors

    It returns an HTTP status code in the response body.

    ParameterDescription
    resultCodeError code
    resultMessageError description
    Error codeDescription
    E900Path parameter error
    E901WORKBOX > Developers API On or Off
    E902Body parameter error
    E903Basic settings is set to NO.
    E904externalKey validation error
    E1001Internal server error
    E1003Failed to upload photo files.
    {
        "resultCode": "E901",
        "resultMessage": "Please check if API is used in the developer console."
    }
    
    HTTP status codeResponse messageDescription
    200OKSuccess
    201CreatedResource successfully created.
    400Bad RequestFailure (It is usually used to respond to the request format that the server cannot understand.)
    500Internal Server ErrorGeneral server error. Whereas 4XX error codes represent client-side errors,
    5XX error codes represent server-side errors.

    Was this article helpful?

    What's Next
    Changing your password will log you out immediately. Use the new password to log back in.
    First name must have atleast 2 characters. Numbers and special characters are not allowed.
    Last name must have atleast 1 characters. Numbers and special characters are not allowed.
    Enter a valid email
    Enter a valid password
    Your profile has been successfully updated.