Skip to content

Commit 31acdbc

Browse files
committed
Add mock responses page
1 parent bbc8dfc commit 31acdbc

File tree

2 files changed

+60
-21
lines changed

2 files changed

+60
-21
lines changed

v0/gettingstarted/sandbox/mocks.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
---
2+
title: Sandbox mocks
3+
excerpt: Get deterministic responses from our Sandbox environment when using the mock mode, according to the following guidelines.
4+
category: 680a72d37e7640001804095b
5+
---
6+
7+
## Using the Sandbox on mock mode
8+
9+
You can use the Sandbox environment in mock mode to get deterministic responses. This is useful for testing and development purposes, as it allows you to simulate API responses without making requests from an actual mobile device.
10+
11+
[Learn more about usage modes](/docs/sandbox#usage-modes)
12+
13+
## Mock responses
14+
15+
When using the Sandbox in mock mode, the following rules apply:
16+
17+
### Number Verification
18+
19+
| Input | Response Status | Response Body |
20+
|--------------|--------------------|------------------|
21+
| **phoneNumber** ends in **1** | 200 | devicePhoneNumberVerified: **true** |
22+
| **phoneNumber** ends in **2** | 200 | devicePhoneNumberVerified: **false** |
23+
| **phoneNumber** ends in **3...0** | 200 | devicePhoneNumberVerified: random (depends on request timestamp being even or odd) |
24+
25+
### QoD (v0.10) create session
26+
27+
| Input | Response Status | Response Body |
28+
|--------------|--------------------|------------------|
29+
| **device** missing or invalid | 400 | message: <error details> |
30+
| **device** > **ipv4Address** > **publicPort** missing when device = ipv4Address | 400 | message: "Missing publicPort" |
31+
| device > **networkAccessIdentifier** / **phoneNumber** / **ipv4Address** / **ipv6Address** ends in **9** | 409 | code: "CONFLICT"<br>message: "Another session is created for the same UE" |
32+
| **applicationServer** missing or invalid | 400 | message: <error on IPv4/IPv6 format> |
33+
| **qosProfile** missing or invalid | 400 | message: <error on QoS profile not listed in the GET profiles operation> |
34+
| **duration** Not in range **1...86400** seconds | 400 | message: <error on duration not in range> |
35+
| Valid input | 201 | sessionId: <session ID><br>startedAt: <device session ID><br>expiresAt: <application server session ID><br>qosStatus: <QoS status><br>messages: <array of messages> |

v0/gettingstarted/sandbox/usethesandbox.md

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -17,44 +17,48 @@ category: 680a72d37e7640001804095b
1717
}
1818
[/block]
1919

20-
## Registering your application
20+
## Usage modes
2121

22-
Open Gateway APIs access is granted to applications, not developers, so every application can have limited access to the scope and for the purpose it needs.
22+
- **Production mode**
2323

24-
[More information on Privacy](/docs/privacy)
24+
Although our Sandbox is not a Channel Partner's production environment but a testing environment instead, it can route your API calls to our mobile operators to provide a real response if you test your prototype application from a device connected to one of their networks. That requires that you are the mobile line holder and have the SIM card installed in such device.
2525

26-
Therefore the way to get credentials to test the APIs is to register an application in the Sandbox console. You will use your application credentials to authenticate your requests to the APIs from any test you code no matter if it is actually a comprehensive application or just a tiny script to run from the a command line interface.
26+
Movistar (Spain) is already available for testing from the Telefónica Open Gateway Sandbox, and other Telefónica operators in other countries will be added soon.
2727

28-
> 📘 How to access the Open Gateway Sandbox
29-
> To use the Sandbox, you must [join the Developer Hub](https://opengateway.telefonica.com/en/developer-hub) and enter in your [private area](https://opengateway.telefonica.com/en/profile/technical-toolbox/sandbox)
28+
The production mode is disabled by default for Privacy reasons, but you can enable it by filling in your legal information and accepting the terms and conditions in the form that the Sandbox console will offer you for that purpose. You will have to provide some mobile phone numbers of your own which will be added to a whitelist that will allow you to test the APIs in production mode from your own devices and will block API usage accessing someone else's personal data.
3029

31-
For every application you create, you will need to follow these simple steps to configure it:
30+
![Production mode and mock mode of Sandbox](https://github.com/Telefonica/opengateway-developers-website/raw/main/v0/gettingstarted/sandbox/images/production_mock.png)
3231

33-
1. Select the APIs you want your application to test. It could be one or several APIs depending on your use case.
32+
- **Mock mode**
3433

35-
![API selection](https://github.com/Telefonica/opengateway-developers-website/raw/main/v0/gettingstarted/sandbox/images/api-selection.png?raw=true)
34+
You can test your application without the need to have a SIM card from one of our mobile operators. The Sandbox will provide you with a mock response for every API call you make.
35+
36+
The mock mode will also make available for you some APIs that are not still commercially available on our mobile operators, so you can test them in advance.
3637

37-
2. Select the usage mode for your application. You have the following options:
38+
## Registering your application
3839

39-
- **Production mode**
40+
Open Gateway APIs access is granted to applications, not developers, so every application can have limited access to the scope and for the purpose it needs.
4041

41-
Although our Sandbox is not a Channel Partner's production environment but a testing environment instead, it can route your API calls to our mobile operators to provide a real response if you test your prototype application from a device connected to one of their networks. That requires that you are the mobile line holder and have the SIM card installed in such device.
42+
[More information on Privacy](/docs/privacy)
4243

43-
Movistar (Spain) is already available for testing from the Telefónica Open Gateway Sandbox, and other Telefónica operators in other countries will be added soon.
44+
Therefore the way to get credentials to test the APIs is to register an application in the Sandbox console. You will use your application credentials to authenticate your requests to the APIs from any test you code no matter if it is actually a comprehensive application or just a tiny script to run from the a command line interface.
4445

45-
The production mode is disabled by default for Privacy reasons, but you can enable it by filling in your legal information and accepting the terms and conditions in the form that the Sandbox console will offer you for that purpose. You will have to provide some mobile phone numbers of your own which will be added to a whitelist that will allow you to test the APIs in production mode from your own devices and will block API usage accessing someone else's personal data.
46+
> 📘 How to access the Open Gateway Sandbox
47+
> To use the Sandbox, you must [join the Developer Hub](https://opengateway.telefonica.com/en/developer-hub) and enter in your [private area](https://opengateway.telefonica.com/en/profile/technical-toolbox/sandbox)
4648
47-
![Production mode and mock mode of Sandbox](https://github.com/Telefonica/opengateway-developers-website/raw/main/v0/gettingstarted/sandbox/images/production_mock.png)
49+
For every application you create, you will need to follow these simple steps to configure it:
4850

49-
- **Mock mode**
51+
1. Select the APIs you want your application to test. It could be one or several APIs depending on your use case
5052

51-
You can test your application without the need to have a SIM card from one of our mobile operators. The Sandbox will provide you with a mock response for every API call you make.
53+
![API selection](https://github.com/Telefonica/opengateway-developers-website/raw/main/v0/gettingstarted/sandbox/images/api-selection.png?raw=true)
5254

53-
The mock mode will also make available for you some APIs that are not still commercially available on our mobile operators, so you can test them in advance.
55+
2. Select the usage mode for your application
5456

5557
![Usage mode](https://github.com/Telefonica/opengateway-developers-website/raw/main/v0/gettingstarted/sandbox/images/usage-mode.png?raw=true)
5658

57-
3. Briefly describe your application as part of the application onboarding process so that mobile operators can understand the purpose of your tests and validate it.
59+
According to the usage modes described [above](#usage-modes)
60+
61+
3. Briefly describe your application as part of the application onboarding process so that mobile operators can understand the purpose of your tests and validate it
5862

5963
Since it is a testing environment, your application won't be rejected as per this information, but our Sandbox uses standard procedures to register applications in the mobile operators' systems which takes this data as mandatory.
6064

@@ -67,7 +71,7 @@ For every application you create, you will need to follow these simple steps to
6771

6872
![App information](https://github.com/Telefonica/opengateway-developers-website/raw/main/v0/gettingstarted/sandbox/images/app-information.png?raw=true)
6973

70-
4. Check the specifications and accept the terms and conditions per API and operator.
74+
4. Check the specifications and accept the terms and conditions per API and operator
7175

7276
Each mobile operator has its own terms and conditions for the usage of each API, and its own technical specifications you will want to consider when it comes to consuming them, so you will need to accept them for each API you want to test on each operator you have previously selected.
7377

@@ -79,7 +83,7 @@ For every application you create, you will need to follow these simple steps to
7983

8084
![Review the summary and confirm](https://github.com/Telefonica/opengateway-developers-website/raw/main/v0/gettingstarted/sandbox/images/review-confirm.png?raw=true)
8185

82-
6. Once you have confirmed, your application is granted access to the Sandbox API gateway with its credentials.
86+
6. Once you have confirmed, your application is granted access to the Sandbox API gateway with its credentials
8387

8488
![alt text](https://github.com/Telefonica/opengateway-developers-website/raw/main/v0/gettingstarted/sandbox/images/app-created.png?raw=true)
8589

0 commit comments

Comments
 (0)