Return Authorizations
Index
To list all return authorizations for an order, make a request like this:
GET /api/v1/orders/R1234567/return_authorizations
Return authorizations are paginated and can be iterated through by passing along a page
parameter:
GET /api/v1/orders/R1234567/return_authorizations?page=2
Parameters
- page:
The page number of return authorization to display.
- per_page:
The number of return authorizations to return per page
Response
{"return_authorizations": [{"id": 1,"number": "RA010584183","state": "authorized","order_id": 14,"memo": "Didn't fit","created_at": "2012-10-24T23:26:23Z","updated_at": "2012-10-24T23:26:23Z"}],"count": 2,"current_page": 1,"pages": 1}
Search
To search for a particular return authorization, make a request like this:
GET /api/v1/orders/R1234567/return_authorizations?q[memo_cont]=damage
The searching API is provided through the Ransack gem which Boxid depends on. The memo_cont
here is called a predicate, and you can learn more about them by reading about Predicates on the Ransack wiki.
The search results are paginated.
Sorting results
Results can be returned in a specific order by specifying which field to sort by when making a request.
GET /api/v1/orders/R1234567/return_authorizations?q[s]=amount%20asc
Response
{"return_authorizations": [{"id": 1,"number": "RA010584183","state": "authorized","order_id": 14,"memo": "Didn't fit","created_at": "2012-10-24T23:26:23Z","updated_at": "2012-10-24T23:26:23Z"}],"count": 1,"current_page": 1,"pages": 1}
Show
To get information for a single return authorization, make a request like this:
GET /api/v1/orders/R1234567/return_authorizations/1
Response
{"id": 1,"number": "RA010584183","state": "authorized","order_id": 14,"memo": "Didn't fit","created_at": "2012-10-24T23:26:23Z","updated_at": "2012-10-24T23:26:23Z"}
Create
To create a return authorization, make a request like this:
POST /api/v1/orders/R1234567/return_authorizations
For instance, if you want to create a return authorization with a number, make above request with following parameters:
{
"order_id": "R1234567",
"return_authorization": {
"stock_location_id": 1,
"return_authorization_reason_id": 2
}
}
Response
{"id": 1,"number": "RA010584183","state": "authorized","order_id": 14,"memo": "Didn't fit","created_at": "2012-10-24T23:26:23Z","updated_at": "2012-10-24T23:26:23Z"}
Update
To update a return authorization, make a request like this:
PUT /api/v1/orders/R1234567/return_authorizations/1
For instance, to update a return authorization’s number, make this request:
PUT /api/v1/orders/R1234567/return_authorizations/1?return_authorization[memo]=Broken
Response
{"id": 1,"number": "RA010584183","state": "authorized","order_id": 14,"memo": "Broken","created_at": "2012-10-24T23:26:23Z","updated_at": "2012-10-24T23:26:23Z"}
Delete
To delete a return authorization, make a request like this:
DELETE /api/v1/orders/R1234567/return_authorizations/1