0

How do i create a Document Library using REST?

When i upload a file to document library, i use this url:

http://industrial-ex/sites/tifdemo/enovia/file.txt with a POST

What is the url for creating a new Document Library?

Thanks in advance.

1
  • btw i'm using java Commented Feb 24, 2015 at 12:53

1 Answer 1

2

Working with lists and list items with REST

url: http://site url/_api/web/lists
method: POST
body: { '__metadata': { 'type': 'SP.List' }, 'AllowContentTypes': true, 'BaseTemplate': 100,
 'ContentTypesEnabled': true, 'Description': 'My list description', 'Title': 'Test' }
Headers: 
    Authorization: "Bearer " + accessToken
    X-RequestDigest: form digest value
    accept: "application/json;odata=verbose"
    content-type: "application/json;odata=verbose"
    content-length:length of post body

Set the BaseTemplate property to 101 to create a document library.

3
  • Don't i need to perform a GET first to get the body content before i make a POST? Commented Feb 25, 2015 at 17:19
  • No, you specify the body content. Check out this video, it shows how to perform CRUD operations using the REST API. youtube.com/watch?v=NIyNs1vXXJA Commented Feb 25, 2015 at 23:46
  • I'm still having problem with this issue, is there a tutorial where they do this in Java ? Or if you can show me how to do it please Commented Apr 7, 2015 at 14:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.