Set REST call method to PUT

How does one set the Method to PUT when using the following?
I have tried appending it to the headers and calling this.http.put() but no luck.

putSomething(): Observable<Object> {
        let json = JSON.stringify({id: '12345'});
        let headers = new Headers();
        headers.append('Content-Type', 'application/json');
        return this.http.put('https://somefunkedoutdomain.com/api/v1/users/:id', json, { headers: headers });
    }

Sorry, didn’t realize the code didn’t go through on the submission of this post.

Did you try, do something like this:

this.http.put(url, JSON.stringify(body), { headers: headers })

??

Could you show the code?

Sorry, didn’t realize the code didn’t go through on the submission of this post.
Added now.

Hhh, json is request body

return this.http.put('https://somefunkedoutdomain.com/api/v1/users/' + id, json, { headers: headers });

The API I am accessing requires 2 parameters however the url ends with/:id.
xr0master - your example suggests the id number is passed in the url but how would the other second required parameter get through?
I tried it. It didn’t work.

It’s tough to do much with phrases like “no luck” and “it didn’t work”. Are you watching network requests? Is anything going over the wire?

PUT is same like POST. All params you could send into request body (your json).

PS or use GET with /api/v1/users/:id/:foo/:bar :smile: