Skip to main content

cURL - API Sample Code

Abstract

cURL - API Sample Code

This section contains code samples for requesting concept schemes and to import project data.

Web Service Method: Request Concept Schemes of a Project

GET Request to Retrieve Concept Schemes of a Project

curl -u superadmin:poolparty -H "Content-Type: application/x-www-form-urlencoded" -X GET "http://performance.semantic-web.at/PoolParty/api/thesaurus/1DDF8B20-104E-0001-1822-1C101D1A19C6/schemes"

Response

[ {
  "uri" : "http://thesaurus.sample.org/thesaurus/Countries",
  "title" : "Countries"
}, {
  "uri" : "http://thesaurus.sample.org/thesaurus/Departments",
  "title" : "Departments"
}, {
  "uri" : "http://thesaurus.sample.org/thesaurus/Regions",
  "title" : "Regions"
}, {
  "uri" : "http://thesaurus.sample.org/thesaurus/Topics",
  "title" : "Topics"
}, {
  "uri" : "http://thesaurus.sample.org/thesaurus/Institutions",
  "title" : "Institutions"
} ]

Web Service Method: Create a Project Using PPAR

curl -u superadmin:poolparty -H "content-type: multipart/form-data" -H "Content-Type: application/x-www-form-urlencoded" -F 'file=@pp_project_cocktails-project.ppar' -X POST https://test-nextrelease.semantic-web.at/PoolParty/api/projects/create

Web Service Method: Import Project Data

Caution

Setting the overwrite parameter to true will overwrite all existing data in the target graph.

Import project data as file in trig format

curl -u superadmin:poolparty -X POST -H "Content-Type: application/trig" --data-binary @MyPoolPartyProject~1DF125DC-B37A-0001-FE7B-E546187E1790~20170125153640896~system.trig "https://darwin.poolparty.biz/PoolParty/api/projects/1DF14216-FAE8-0001-F9CB-561015371BE8/import?overwrite=true"

Import project data as file in ttl format

If you want to import project date in a context free format such as Turtle, you need to additionally include the defaultGraph parameter to specify the target graph to be used for the imported statements.

curl -u xxx --request POST "https://xxx.biz/PoolParty/api/projects/id/import" --form 'file=@import.ttl' --form 'overwrite=true' --form 'defaultGraph=concepts'