Skip to content

Instantly share code, notes, and snippets.

@denlab
Created October 6, 2012 22:15
Show Gist options
  • Save denlab/3846358 to your computer and use it in GitHub Desktop.
Save denlab/3846358 to your computer and use it in GitHub Desktop.
(defn create-attr-map
[attr-code attr-type src-code]
{"attribute"
{"name" attr-code
"attributeType" {"href" (format "/foundation/v2/attributeTypes/%s" attr-type)}
"source" {"href" (format "/foundation/v2/%s" src-code)}}})
(comment
(def att0 (create-attr-map "new-attr-code" "String" "System"))
(json-encode att0))
(defn put-attr
"Put an attribute into wikeo"
[attr-code attr-type src-code]
(wikeo-query :put
(format "/foundation/v2/attributes/%s" attr-code)
{:body (json-encode (create-attr-map attr-code attr-type src-code))
:content-type :json}))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment