Locations

The API- functions for Locations in Papershift



Get Locations

Get location(s) from your Papershift account

URL

https://app.papershift.com/public_api/v1/locations

Method

GET

Parameters

ParametersTypeRequired
api_tokenStringrequired

Information

A successful request returns all locations

Example

{
        "api_token" : "6ooIiSZaiBwaFBLxveJkm7pP8uTOPLPSwDL6QsOK"
      }
var settings = {
  "async": true,
  "crossDomain": true,
  "url": "https://app.papershift.com/public_api/v1/locations?api_token=eeMbGG4pOojjDuRIyNgrSj75xpTLevTKtGzkJBOw",
  "method": "GET",
  "headers": {
    "cache-control": "no-cache",
    "postman-token": "6ooIiSZaiBwaFBLxveJkm7pP8uTOPLPSwDL6QsOK"
  }
}

$.ajax(settings).done(function (response) {
  console.log(response);
});
{
  "locations": [
    {
      "id": 1,
      "name": "Test AG",
      "updated_at": "2016-08-04T20:21:11+02:00",
      "external_id": "test",
      "status": "active"
    }
  ]
}



Get Location by ID

Get location by its unique ID or external ID

URL

https://app.papershift.com/public_api/v1/locations

Method

GET

Parameters

ParametersTypeRequired
api_tokenstringrequired
idintegerrequired
external_idstringrequired if id is not set

Example

{
    "api_token": "XXXX",
    "id": 64785
}
{
    "id": 64785,
    "name": "Julias Standort",
    "updated_at": "2019-07-02T11:28:15+02:00",
    "external_id": "loc_julia",
    "status": "active"
}



Create Location

Create a new location

URL

https://app.papershift.com/public_api/v1/locations

Method

Post

Parameters

ParametersTypeRequired
api_tokenstringrequired
namestringrequired
activestringoptional
user_idintegeroptional

Example

{
    "api_token": "XXXX",
    "name": "HQ",
    "user_id": "42"
}
{
    "id": 64785,
    "name": "HQ",
    "updated_at": "2019-07-02T11:28:15+02:00",
    "status": "active"
}

The parameter user_id in the create location method allows adding a specific user as super-admin of the freshly created location.
If it is omitted, the created location will be empty.





Update Location

Update an existing location

URL

https://app.papershift.com/public_api/v1/locations

Method

PUT

Parameters

ParametersTypeRequired
api_tokenstringrequired
idintegerrequired
external_idstringrequired if id is not set
namestringoptional
activestringoptional

Example

{
    "api_token": "XXXX",
    location: {
    "id": "42",
    "name": "HQ Berlin"
    }
}
{
    "id": 64785,
    "name": "HQ Berlin",
    "updated_at": "2019-07-03T11:28:15+02:00",
    "status": "active"
}



Delete Location

Delete an existing location

URL

https://app.papershift.com/public_api/v1/locations

Method

DELETE

Parameters

ParametersTypeRequired
api_tokenstringrequired
idintegerrequired
external_idstringrequired if id is not set

Example

{
    "api_token": "XXXX",
    location {
    "id": "42"
    }
}
{
    "id": 64785,
    "name": "HQ",
    "updated_at": "2019-07-02T11:28:15+02:00",
    "status": "inactive"
}