Forum Discussion

gstelang's avatar
gstelang
Mentor
7 years ago

How to HTTP POST / DELETE with Community v2 API?

Hi folks, 

 

The documentation is not very clear how to do HTTP POST or DELETE. The GET is the LIQL query from the studio editor whereas where would I do HTTP POST and DELETE from? From studio editor? from client side javascript? who would do the call - rest admin or on behalf of the user?

 

For example: https://community.lithium.com/t5/Developer-Documentation/bd-p/dev-doc-portal?section=commv2&collection=albums#action-create 

 

POST /community/2.0/mytenantid/albums HTTP/1.1

Where should I make this POST request from? 

  • gstelang  

    Delete (HTTP DELETE) and Update(HTTP PUT)is not allowed as mentioned in doc. 

    Create(HTTP POST): I would suggest you to use it inside the endpoint on the behalf of user as you have to pass the user id as an album owner. 

    POST /community/2.0/mytenantid/albums HTTP/1.1
    Host: api.lithium.com
    Content-Type: application/json
    Cache-Control: no-cache
    client-id: czY8mbW76Ac/Wz6+bAMhCm+sW5WSyhAO2odh28TB1/c=
    
    {
        "data":{
                "type":"album",
                "title":"my favorites",
                "description":"my favorite uploads",
                "owner":{
                    "id":"32"
                }
        }
    }