• General
  • My Apps
  • SDKs
  • Protocols
  • Structures
  • Methods
  • Errors
Log in Register Log out
  • General

  • My Apps

  • SDKs
    • C
    • Java
    • Javascript
    • Php
    • Swift

  • Protocols
    • HTTP JSON Protocol
      • Authentication
      • Single Connection
      • Uploading Files
    • Binary Protocol
      • Sending Binary Request
      • Sending Files
      • Receiving Binary Response
      • Receiving Files Data

  • Structures
    • Datetime
    • Event
    • Filenames
    • Metadata
    • Share
    • Tree

  • Methods
    • Intro
      • Global Parameters
      • Authentication
    • General
      • getdigest
      • userinfo
      • supportedlanguages
      • setlanguage
      • feedback
      • currentserver
      • diff
      • getfilehistory
      • getip
      • getapiserver
    • Folder
      • createfolder
      • createfolderifnotexists
      • listfolder
      • renamefolder
      • deletefolder
      • deletefolderrecursive
      • copyfolder
    • File
      • uploadfile
      • uploadprogress
      • downloadfile
      • downloadfileasync
      • copyfile
      • checksumfile
      • deletefile
      • renamefile
      • stat
    • Auth
      • sendverificationemail
      • verifyemail
      • changepassword
      • lostpassword
      • resetpassword
      • register
      • invite
      • userinvites
      • logout
      • listtokens
      • deletetoken
      • sendchangemail
      • changemail
      • senddeactivatemail
      • deactivateuser
    • Streaming
      • getfilelink
      • getvideolink
      • getvideolinks
      • getaudiolink
      • gethlslink
      • gettextfile
    • Archiving
      • getzip
      • getziplink
      • savezip
      • extractarchive
      • extractarchiveprogress
      • savezipprogress
    • Sharing
      • sharefolder
      • listshares
      • sharerequestinfo
      • cancelsharerequest
      • acceptshare
      • declineshare
      • removeshare
      • changeshare
    • Public Links
      • getfilepublink
      • getfolderpublink
      • gettreepublink
      • showpublink
      • getpublinkdownload
      • copypubfile
      • listpublinks
      • listplshort
      • deletepublink
      • changepublink
      • getpubthumb
      • getpubthumblink
      • getpubthumbslinks
      • savepubthumb
      • getpubzip
      • getpubziplink
      • savepubzip
      • getpubvideolinks
      • getpubaudiolink
      • getpubtextfile
      • getcollectionpublink
    • Thumbnails
      • getthumblink
      • getthumbslinks
      • getthumb
      • savethumb
    • Upload Links
      • createuploadlink
      • listuploadlinks
      • deleteuploadlink
      • changeuploadlink
      • showuploadlink
      • uploadtolink
      • uploadlinkprogress
      • copytolink
    • Revisions
      • listrevisions
      • revertrevision
    • Newsletter
      • newsletter_subscribe
      • newsletter_check
      • newsletter_verifyemail
      • newsletter_unsubscribe
      • newsletter_unsibscribemail
    • Trash
      • trash_list
      • trash_restorepath
      • trash_restore
      • trash_clear
    • Collection
      • collection_list
      • collection_details
      • collection_create
      • collection_rename
      • collection_delete
      • collection_linkfiles
      • collection_unlinkfiles
      • collection_move
    • OAuth 2.0
      • authorize
      • oauth2_token
    • Transfer
      • uploadtransfer
      • uploadtransferprogress

  • Errors

Binary API SDK



The Binary API SDK could be found here: https://github.com/pcloudfs/pclouddoc/tree/master/binapi-c

Macro

To pass parameters to commands, the following macro are used:

(ignore the comments about number of evaluations if you are passing string literals or just regular variables as parameters to macro, they are intended to warn you not to do stuff like P_STR("name", str++) )

P_STR

Name

P_STR("paramname", "param value")

Description

string argument, both first and second arguments are evaluated twice.

P_LSTR

Name

P_LSTR("paramname", "param value", value_len)

Description

String argument, with know value length. Value does not need to be null terminated, value and value_len are evaluated just once, paramname is evaluated twice.

P_NUM

Name

P_NUM("paramname", uin64_t_num_value)

Description

Number argument, name is evaluated twice, the number just once.

P_BOOL

Name

P_BOOL("paramname", bool)

Description

Bool can be anything that can evaluate as true/false (pointer, number). The bool argument is evaluated once, the name twice.

Methods

api_connect

Name

apisock *api_connect();

Description

Connect to an api server, on failure return NULL.

api_connect_ssl

Name

apisock *api_connect_ssl();

Description

Connect to an api server via SSL, on failure return NULL.

api_close

Name

void api_close(apisock *sock);

Description

Closes connection to the server.

send_command

Name

binresult *send_command(apisock *sock, const char *command, ...);

Description

Sends a command to the server and return result. This is a macro, evaluating the command parameter twice. The ... stands for any number of parameters. NULL indicates an error, non-NULL result will be the command's response and needs to be deallocated with free().

send_command_nb

Name

binresult *send_command_nb(apisock *sock, const char *command, ...);

Description

Same as send_command, but does not read the result from the api server. On failure returns NULL, on success returns PTR_OK, which does not need to be freed. You are supposed to read the result with get_result() when you are ready to do so.

send_data_command

Name

*send_data_command(apisock *sock, const char *command, uint64_t datalen, ...);

Description

Same as send_command_nb, but indicates that you will be sending data with the request. You are supposed to write datalen bytes to the connection after this call (if it's successful) with writeall() and get the result with get_result().

get_result

Name

*get_result(apisock *sock);

Description

Reads and parses the first waiting result sent command . Non-NULL return value indicates success and needs to be deallocated with free().

writeall

Name

int writeall(apisock *sock, const void *ptr, size_t len);

Description

Writes all the len bytes at *ptr to the socket and returns 0 on success and -1 on error.

readall

Name

ssize_t readall(apisock *sock, void *ptr, size_t len);

Description

Reads all len bytes from the socket to *ptr and returns the number of bytes read (always len) or -1 on error.

2014 © pCloud. Terms and Conditions. Privacy Policy. Intellectual Property.
© pCloud. Terms and Conditions. Privacy Policy. Intellectual Property.
Reset Password
Check your e-mail for further instructions.
Reset