rktvk
1 Functions
auth
call
2 Examples
3 Notes
7.2

rktvk

Aydar Zarifullin <[email protected]>

 (require rktvk) package: rktvk

Racket library for working with VK API.

1 Functions

For authorization you need to use the auth function:

procedure

(auth client-id    
  client-secret    
  username    
  password    
  [#:params params])  any/c?
  client-id : (or/c number? string?)
  client-secret : string?
  username : (or/c number? string?)
  password : string?
  params : hash? = (hash)

client-id

 

your application ID

client-secret

 

secret key of your application

username

 

user login

password

 

user password

params

 

All optional parameters

To call a VK API method you need to use the call function:

procedure

(call method-name    
  access-token    
  v    
  [#:params params])  any/c?
  method-name : string?
  access-token : string?
  v : (or/c number? string?)
  params : hash? = (hash)

method-name

 

method name from the list of API functions

access-token

 

access key received after successful application authorization

v

 

API version

params

 

parameters of the corresponding API method

2 Examples

Authorization request example:

(auth 3140623 "VeWdmVclDCtn6ihuP1nt" "79650254293" "CpdnxEY{Nf")

In response to such request you will receive a hash:

'#hash((user-id . 77764136) (access-token . "533bacf01e11f55b536a565b57531ac114461ae8736d6506a3") (expires-in . 0))

users.get VK API method call example:

(call "users-get" "533bacf01e11f55b536a565b57531ac114461ae8736d6506a3" 5.92 (hash 'user-ids 210700286 'fields "bdate"))

Response:

'#hash((response . (#hash((bdate . "21.9.1986") (can-access-closed . #t) (first-name . "Lindsey") (id . 210700286) (is-closed . #f) (last-name . "Stirling")))))

3 Notes

For example:

users.get becomes users-get

users.getFollowers becomes users-get-followers